On Debian squeeze. Running
ps -p $$ shows
bash is my current shell,
ls -l $(which sh) shows
sh is a symlink to
bash. So why, when I run
man sh, do I get the man page for
dash? Is this just a bug in Debian?
The system default shell is different than your user shell. On my system,
So, a shell script with
It sounds like your system somehow has half and half, where the /bin/sh symlink and manpage symlink got out of sync. The manpage symlink on my system is:
If you've manually changed the /bin/sh one, you'll have to change that one, too. Possible there is a bug around handling those symlinks, too; mpy points out Bug #662159.
Each user has a setting for which shell to invoke on login. That's a per-user setting, stored in
There is also a
TL;DR /bin/sh used to be a completely different shell in other UNIXes (Solaris) but was Bash in Linux, but Debian decided to have a custom /bin/sh shell for various reasons (mostly code size).
The original shell was Bourne shell. POSIX rules require that a Bourne compatible shell is installed as /bin/sh. This is what you get when you ask for
Bourne shell actually was pretty raw. It didn't have a lot of interactive features that people wanted in a command interpreter. it had no history mechanism, no aliases, etc. So there were some additions made. First this came in tcsh, then in Korn shell, then in Bash.
When you're making a Linux distro, you need to follow POSIX rules for /bin/sh. They saw "hey we have Bash, which is shell forward compatible from Bourne shell". Why don't we just strip the few features from it and install it as /bin/sh? Most distros did this.
But there are some problems with this. Bash has a lot of features (readline bindings, programmable completion, dictionary arrays, etc...) and is actually pretty big on memory, and has a few library dependencies. These are not particularly good when you're in "my system is borked" mode. You care more about getting your system up than worrying about if I have a fully programmable prompt at that point.
So, the Debian folks went back to the future, and have a specialized, stripped Bourne shell as /bin/sh. It's smaller, fewer dependencies, and in theory can be more reliable at startup. The downside is that there may be startup scripts that kind of depended on /bin/sh really being Bash underneath, and may use those features. But those are scripts that were coded out of spec, and should be fixed.