Re: #!/bin/sh versus #!/bin/bash

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

 



Am Fr, den 09.01.2004 schrieb Matthew Zimmerman um 23:57:
> 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

Works here without any problem.
Hint: let the shebang line be #!/bin/bash -x

> 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

Alexander


-- 
Alexander Dalloz | Enger, Germany
PGP key valid: made 13.07.1999
PGP fingerprint: 2307 88FD 2D41 038E 7416  14CD E197 6E88 ED69 5653




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

  Powered by Linux