Am 20.06.2011 12:39, schrieb Adam Carter: >>> /bin/sh is a symlink to bash. >> >> Which runs as sh when run from the symlink. > > I dont understand. "runs as" usually means "runs under the user > context" to me - are you saying bash has an sh compatibility mode? >
Yes, that's exactly what he wants to say. Interestingly, that mode still supports most bash-only features like arrays. I guess they can do this because it doesn't change the semantic of old Bourne shell code. It just makes some formerly invalid syntax valid. /bin/sh -c -c 'array=( sh bash ); echo I am a ${array[1]}' 2>/dev/null || echo I am a sh > I am a bash Other drop-in replacements for /bin/sh like dash are less forgiving: /bin/dash -c -c 'array=( sh bash ); echo I am a ${array[1]}' 2>/dev/null || echo I am a sh > I am a sh
signature.asc
Description: OpenPGP digital signature