![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Code Understand ? | varungupta | UNIX for Advanced & Expert Users | 2 | 05-02-2008 07:34 PM |
| Not able to understand what's do the statement | div_Neev | Shell Programming and Scripting | 1 | 02-20-2008 05:46 AM |
| Can't understand sar command | shaan_dmp | UNIX for Dummies Questions & Answers | 1 | 10-23-2007 07:04 AM |
| can't understand | BoyArcher | UNIX for Dummies Questions & Answers | 5 | 03-14-2006 09:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
can't understand this at all.
Ok, i've been trying to write some shell scripts. nothing challenging, but just automating
All of the tutorials i read say to start the file with #!/bin/bash or whatever your path to bash is. So i do it, and all of my scripts error out saying ./nameofscript:command not found when i remove the line completely the script seems to run ok. Why?? I understand the easy answer is to say "so just leave the line out" but I really would like to understand why it's happening. thanks, chris |
|
|||||
|
First, read this: What does "#! /usr/bin/ksh" mean?
And then you need to figure out where bash is, if you have it at all. What OS are you using? Run the command "uname -a" and post the results so we know. "echo $SHELL" will probably tell you what shell you are using. Also try: which bash which ksh |
|
||||
|
thanks for that link. apparently I am about 50 steps ahead of myself
uname -a result Code:
FreeBSD PCBSD.localhost 6.1-RELEASE-p2 FreeBSD 6.1-RELEASE-p2 #1: Thu Jul 6 11:31:02 PDT 2006 root@PCBSD.localhost:/usr/obj/usr/src/sys/PCBSDv1.2 i386 Code:
/bin/csh Code:
PCBSD# which bash /usr/local/bin/bash PCBSD# which ksh ksh: Command not found. chris |
|
||||
|
by the way, i suspect the reason your script runs fine without that line has something to do with it running using *your* shell. As above, it's much more sensible to specify the path to a command interpreter explicitly, since then you can specify which command interpreter to use in each script (for example, if you have different scripts that use different command interpreters). Depending on how your system's set up, you'd usually have to type "sh ./nameofscript" or something similar to run a script using an interpreter other than the one specified.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|