I just barely landed a job where 80% of my work is in the Unix Environment. I'm learning how to shell script. I'm really having a hard time trying to set the header on my practice scripts. If you take a look at my first script, it accepts the header. I created the same header again on a new script and it give me a bad interpreter. Both were created executables using the command chmod u+x nameOfScript
. Both scripts are in the same location. So I really don't understand what's going on. Take a look:
parallels@ubuntu:~$ cat firstApp.ksh
#!usr/bin/ksh
# this prints the first line.
echo "Hi this is my first app, which me luck!"
echo "i hope this works again"
#this is a comment as well
Now look at my other script which doesn't work, same header
parallels@ubuntu:~$ cat thirdApp.ksh
#!usr/bin/ksh
#print this
echo "I'm gonna try this again"
When I run this script, it runs...
parallels@ubuntu:~$ ./firstApp.ksh
Hi this is my first app, which me luck!
i hope this works again
But when I run this it fails
parallels@ubuntu:~$ ./thirdApp.ksh
bash: ./thirdApp.ksh: usr/bin/ksh: bad interpreter: No such file or directory
I'm copying the header exactly on both scripts, when I look for the Korn shell header I get this
parallels@ubuntu:~$ which ksh
/usr/bin/ksh
parallels@ubuntu:~$
Please let me understand what I'm doing wrong. Unix is still very new to me.