Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In the following bash session, I have /bin/sh symlinked to /bin/bash. However, when I run /bin/sh, the result is not the same as running /bin/bash...any idea whats happening there?

benno@benno-laptop:~$ ls -l /bin/sh
lrwxrwxrwx 1 root root 9 2009-08-28 19:56 /bin/sh -> /bin/bash
benno@benno-laptop:~$ /bin/sh
sh-3.2$ exit
exit
benno@benno-laptop:~$ /bin/bash
benno@benno-laptop:~$ exit
exit
benno@benno-laptop:~$
share|improve this question

1 Answer 1

up vote 6 down vote accepted

From here: "If Bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the posix standard as well. "

share|improve this answer
1  
This kind of invocation-name polymorphism is a rare but treasured part of the unix programming lore. Once you advance beyond casual use, you should be away of it. Another common place to see it is in the grep, egrep, fgrep family. –  dmckee Aug 28 '09 at 19:26
1  
Busybox (busybox.net) takes this paradigm about as far as it'll go :) –  moonshadow Aug 28 '09 at 19:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.