Computer History Notes - Herong's Tutorial Notes - v3.12, by Dr. Herong Yang
Command Interpreters and Command Pipelines
This section provides a quick introduction of UNIX command interpreters, shells, and command pipelines.
Unix supports command interpreters as separate programs called shells. Multiple shells can be supported on a single UNIX system. The following commands session shows 4 shells are supported on the system. User can switch shells at any time:
$ls /bin | grep sh bash csh sh tcsh (Listing all available shells $set | grep -i shell SHELL=/bin/sh (Looking at the current shell $tcsh % (Switching to Tcsh %set | grep -i shell shell /bin/tcsh (Looking at the current shell %exit $ Switching back to the first shell
Unix supports command pipelines so that multiple commands can be linked with data producer-consumer relations. The following commands session shows some examples of command pipelines:
%tar -cO * | compress > backup.tar.Z (Combining all files into an archive and compress it to a file %who | pr -2 | lpr -Pxx (Printing all logged in users in 2 columns %curl "http://en.wikipedia.org/wiki/Pipeline (Unix)" | \ sed 's/[^a-zA-Z ]/ /g' | \ tr 'A-Z ' 'a-z\n' | \ grep '[a-z]' | \ sort -u | \ comm -23 - /usr/dict/words (Spell-checking a Web page source code
Table of Contents