Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
benno@benno-laptop:~$ /bin/bash
benno@benno-laptop:~$ exit
share|improve this question
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
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
Busybox ( takes this paradigm about as far as it'll go :) – moonshadow Aug 28 '09 at 19:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .