3

I am currently using the bash shell but am a bit confused about man entries. For example the man entry for source (man source):

DESCRIPTION
  sh
     The exec command specified by the arguments is  executed  in...

  csh
     exec executes command in place of the current  she...

  ksh
     With the exec built-in, if arg is give...

There are entries for several shells but not for the bash shell. I know that bash stands for Bourne Again SHell so does this imply that the description for sh is the one that applies to bash?

Thanks

1
  • Recall that sh is the Bourne shell, and bash is the Bourne-again shell.
    – eleven81
    Commented Feb 16, 2010 at 14:33

3 Answers 3

1

That man-page looks like it comes from a Unix (rather than Linux) system, like Solaris.

On Solaris, /bin/sh is the original Bourne shell, which lacks history, completion or the more advanced parameter substition that you'd find in ksh, POSIX and Bash shells. Also , command substitution can only be done with backticks, and not with $(command).

(Though if you have /usr/xpg4/bin earlier in your PATH, running 'sh' will get you the POSIX-compatible shell instead.)

As profjim says, use man bash for details of Bash syntax.

1

On many distros, sh is a link to bash, so yes running sh will give you bash, however it will be running in a restricted, sh-compatible mode. You can't rely on this without checking, though. sh might instead be a link to dash, or to its own binary.

For bash references, do man bash. Also look at the Bash Reference Manual and the Advanced Bash Scripting Guide.

1
1

If you're looking for help on a specific bash builtin, usually

help [builtin_name]

is what you want.

You must log in to answer this question.

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