Doubt in shebang line!!

Do we need to include the exclamatory mark in the shebang line??:confused:
What if we dont include it??:eek:

Actually what shebang line implies when we run a script??

shebang line--> #!/bin/ksh :stuck_out_tongue:

Perhaps this link may help you - http://www.unix.com/answers-frequently-asked-questions/7077-what-does-usr-bin-ksh-mean.html

Even if i dont include it, ma sscript is running fine..

so whats the point in including it??:smiley:

Consider this, for example:

$ ps -p $$
      PID    PPID    PGID     WINPID  TTY  UID    STIME COMMAND
     2616    3828    2616       4044    1 1003 11:56:15 /usr/bin/bash
$ cat s  
#! /usr/local/bin/zsh

print -l **/*(/)
$ ./s
backup
dir1
$ sed -i 1d s
$ cat s

print -l **/*(/)
$ ./s
./s: line 2: syntax error near unexpected token `('
./s: line 2: `print -l **/*(/)

hi radoulov,

am working in ksh and i tried ur snippet..its not givin any error if we don include shebang:(

So you get the idea, try executing it from another shell ...

$ ksh -c 'print -l **/*(/)'  
ksh: print: -l: unknown option
$ ksh93 -c 'print -l **/*(/)'
/var/opt/ast/bin/ksh[1]: print: -l: unknown option
Usage: print [-enprsv] [-f format] [-u fd] [string ...]
$ zsh -c 'print -l **/*(/)' 
backup
dir1
$ bash -c 'print -l **/*(/)' 
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `print -l **/*(/)'
$ dash -c 'print -l **/*(/)'
zsh: correct 'dash' to 'ash' [nyae]? y
Syntax error: "(" unexpected
$ sh -c 'print -l **/*(/)' 
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `print -l **/*(/)'
$ csh -c 'print -l **/*(/)'
Badly placed ()'s.
$ tcsh -c 'print -l **/*(/)'
Badly placed ()'s.
$ pdksh -c 'print -l **/*(/)'
pdksh: print: -l: unknown option

It just helps you in using the intended shell, for example time in csh isn't the same in ksh, it's built in and different. The ksh uses /usr/bin/time (depends I'm sure).