Page 1 of 1

What's the difference between !/bin/sh and !/bin/bash?

Posted: Tue 23 May 2006, 16:29
by NickBiker
Hi!

Just wondered if anyone could help with this slightly odd problem!

In the Puppy console I can type:

Code: Select all

#alpha="abcdef"
#echo ${alpha/abc/xyz}
#xyzdef
Which is how it should be using the substition {a/b/n}

BUT if I do the same thing in a standard script I get an error:

Code: Select all

#!/bin/sh

alpha="abcdef"
echo ${alpha/abc/xyz}
I get: ...4: Syntax error: Bad Substitution

Am I going mad!

:shock:

Posted: Tue 23 May 2006, 16:48
by MU
#!/bin/bash
not
#!/bin/sh

Mark

Posted: Tue 23 May 2006, 18:32
by NickBiker
MU wrote:#!/bin/bash
not
#!/bin/sh

Mark
Hi!

Oh! I thought /bin/sh would be a symbolic link to bash? What is it then?!

Thanks for help :roll:

Posted: Tue 23 May 2006, 18:47
by MU
no, sh is a symbolic link to busybox.
Busybox has the more limited ash -shell, that is used in image.gz when Puppy boots.
ash has less possibilities than bash, but allows to keep image.gz small.

Mark

Posted: Wed 24 May 2006, 10:30
by NickBiker
MU wrote:no, sh is a symbolic link to busybox.
Busybox has the more limited ash -shell, that is used in image.gz when Puppy boots.
ash has less possibilities than bash, but allows to keep image.gz small.

Mark
Hi Mark

Thanks for help! I was wondered if I was going mad a could not get for loops to work either! Still it is good practice to work out ways to do things using a limited command set!!