View Full Version : IS there a difference between pointing to /bash or /sh ??
November 9th, 2006, 11:53 PM
i just want to know if there's a difference when you start a script with #!/bin/bash or #!/bin/sh ??? does it affect the script in any way if one is used over the other? (aren't bash and sh the same thing? i guess thats what im trying to say...)
November 9th, 2006, 11:55 PM
Typically, /bin/sh is a symlink to /bin/bash, so in most situations it doesn't matter. On Edgy /bin/sh is a symlink to /bin/dash, so you might run into some compatibility issues. My suggestion would be to use `#!/bin/bash`. Search the forums, there have been some people having problems installing stuff on Edgy using shell scripts.
November 9th, 2006, 11:58 PM
Actually, that's a very common mistake to use #!/bin/sh when using bash specific features.
There should never have been a symlink from sh to bash in the first place, that's what caused these scripts to work on some systems (a certain number of linux distributions) and not on others (like *bsd, or other linux distributions, like ubuntu which is now using dash).
November 10th, 2006, 12:28 AM
im asking because the tovid installation script i made seemed to not work in edgy if it was pointing to bash, but it worked when pointing to sh.
does anyone know why edgy devs decided to symlink to dash in the first place? (and what exactly is dash!)
November 10th, 2006, 12:38 AM
Dash is the debian almquist shell. It's lighter and somewhat faster than bash, and it's more strictly POSIX compliant. Bash seems to make the better login shell; however, which is why it's still the default login shell.
November 11th, 2006, 03:57 AM
hey whastup with this!!!
i tried to execute my tovid script (which starts with #!/bin/bash) but it returned this error:
bash: ./installtovid.sh: /bin/bash^M: bad interpreter: No such file or directoryi dont know why it does that...it has executable permissions, and i tried aysiu's songbird script, (which starts out with bash also, )and that worked fine.
edit: btw, im using dapper again
November 11th, 2006, 06:48 AM
^M is a carriage return I believe (\r). You must have downloaded this file either from a Windows or Mac box and transferred it over or something along those lines. Use tr (http://www.die.net/doc/linux/man/man1/tr.1.html) to remove the \r's from your script.
November 11th, 2006, 06:55 AM
yes i did transfer it from a windows machine. thanks for the reply. i don't really get how to use tr yet, but i'll get the hang of it soon enough.
November 11th, 2006, 07:01 AM
$ cat script.sh | tr -d \r > newscript.sh
November 11th, 2006, 07:21 AM
$ cat script.sh | tr -d \r > newscript.shwell i didn't do what you suggested, but i still got it to work. i had saved my script in .txt format, and then uploaded it to my web server, so that i could just copy/paste the script into a new document, and it worked.
thanks for all ur help.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.