B.3. bash versus sh

The Bourne Again (bash) shell has the following features not found in the traditional Bourne shell (sh).

  • Formatting the prompts

  • History (csh style)

  • Aliases

  • A built-in command line editor (emacs or vi) for editing the command line

  • Directory manipulation with pushd and popd

  • Csh-type job control to stop or run jobs in the background, bring them to the foreground, etc. with command such as bg, fg, Ctrl-Z, etc.

  • Tilde, brace, and parameter expansion

  • Key bindings to customize key sequences

  • Advanced pattern matching

  • Arrays

  • The select loop (from Korn shell)

  • Many new built-in commands

Feature csh/tcsh Bourne Bash Korn
Variables:
Assigning values to local variables set x = 5 x=5 x=5 x=5
Assigning variable attributes   declare or typeset typeset ...

Get UNIX® Shells by Example, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.