#!/bin/sh versus #!/bin/bash
Matthew Zimmerman
mzimmerman at virginia.edu
Fri Jan 9 22:57:08 UTC 2004
I can't seem to get bash scripts to run by themselves
if I put /bin/bash in the poundbang line of my Bash shell
scripts . If I use /bin/sh (I run Bash interactively),
things work normally:
---
matt at macko ~ $ vim test.sh
matt at macko ~ $ chmod +x test.sh
matt at macko ~ $ cat test.sh
#!/bin/sh
echo Hello world
matt at macko ~ $ ./test.sh
Hello world
matt at macko ~ $ . ./test.sh
Hello world
---
However, if I modify the poundbang line to call /bin/bash
instead...
---
matt at macko ~ $ vim test.sh
matt at macko ~ $ chmod +x test.sh
matt at macko ~ $ cat test.sh
#!/bin/bash
echo Hello world
matt at macko ~ $ ./test.sh
./test.sh: ./test.sh: No such file or directory
matt at macko ~ $ . ./test.sh
Hello world
---
But both binaries are there:
---
matt at macko ~ $ ls -l /bin/{,ba}sh
-rwxr-xr-x 1 root root 599860 Oct 28 09:15 /bin/bash*
lrwxrwxrwx 1 root root 4 Dec 12 16:11 /bin/sh -> bash*
---
Any ideas what the heck is going on? I've noticed this on RH8
and RH9 as well.
--
Matt
Matthew Zimmerman
Interdisciplinary Biophysics, University of Virginia
http://www.people.virginia.edu/~mdz4c/
----------------------------------------------------
Lab: 4-223 Jordan Hall, 1300 Jefferson Park Avenue,
Charlottesville, VA 22908 (434)924-2948
Home: 2655-C Barracks Road
Charlottesville, VA 22901 (434)244-7989
More information about the fedora-list
mailing list