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

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
NickBiker
Posts: 155
Joined: Wed 01 Mar 2006, 13:06
Location: Guildford, UK
Contact:

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

#1 Post 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:
Nick

See my Puppy webcam Guide at:
www.moyo.me.uk/pupplinux

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

#!/bin/bash
not
#!/bin/sh

Mark

User avatar
NickBiker
Posts: 155
Joined: Wed 01 Mar 2006, 13:06
Location: Guildford, UK
Contact:

#3 Post 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:
Nick

See my Puppy webcam Guide at:
www.moyo.me.uk/pupplinux

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#4 Post 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

User avatar
NickBiker
Posts: 155
Joined: Wed 01 Mar 2006, 13:06
Location: Guildford, UK
Contact:

#5 Post 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!!
Nick

See my Puppy webcam Guide at:
www.moyo.me.uk/pupplinux

Post Reply