#!/bin/sh versus #!/bin/bash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@macko ~ $ vim test.sh
matt@macko ~ $ chmod +x test.sh
matt@macko ~ $ cat test.sh
#!/bin/sh
 
echo Hello world
matt@macko ~ $ ./test.sh
Hello world
matt@macko ~ $ . ./test.sh
Hello world
---

However, if I modify the poundbang line to call /bin/bash
instead...

---
matt@macko ~ $ vim test.sh
matt@macko ~ $ chmod +x test.sh
matt@macko ~ $ cat test.sh
#!/bin/bash
 
echo Hello world
matt@macko ~ $ ./test.sh
./test.sh: ./test.sh: No such file or directory
matt@macko ~ $ . ./test.sh
Hello world
---

But both binaries are there:

---
matt@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




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux