ultimate_differences_amongst_unix_shells
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ultimate_differences_amongst_unix_shells [2021/03/09 23:45] – [C Shell] hc9 | ultimate_differences_amongst_unix_shells [2024/08/31 07:11] (current) – [Other Shells] _rc hc9 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Ultimate Differences Amongst UNIX® Shells ====== | ||
+ | |||
+ | This tutorial is a work in progress (WIP). | ||
+ | |||
+ | ===== Introduction ===== | ||
+ | |||
+ | The UNIX shells described in this tutorial include: osh (a port of the Thompson shell), sh (and sh-like shells), csh (and csh-like shells), and others. | ||
+ | |||
+ | What are the critical differences and/or similarities among the various UNIX shells? The differences are generally command-line syntax issues. | ||
+ | |||
+ | In the following sections, each example command line is noted by "Ecl [123]:" | ||
+ | |||
+ | The similarities among the UNIX shells described in this tutorial are more important than the differences. This is because when you learn how to use one shell, you in effect also learn how to use the others. In essence, each of the shells plays the same role from the user's perspective. That role is to act as an interface to the functionality which is available in the UNIX operating system. | ||
+ | |||
+ | ===== Thompson Shell ===== | ||
+ | |||
+ | In UNIX history, the Thompson shell preceded both the Bourne shell and the C shell, and its command language is a subset of both of these shells. Control flow in the Thompson shell is implemented via [[http:// | ||
+ | |||
+ | An enhanced port of the Thompson shell is available on SDF as ''/ | ||
+ | |||
+ | **Ecl 1:** | ||
+ | |||
+ | % setenv PATH / | ||
+ | / | ||
+ | |||
+ | **Ecl 2:** | ||
+ | |||
+ | % which osh if goto ^ ( tr ' | ||
+ | -r-xr-xr-x | ||
+ | -r-xr-xr-x | ||
+ | -r-xr-xr-x | ||
+ | |||
+ | **Ecl 3:** | ||
+ | |||
+ | % if -r /netbsd echo /netbsd: Is readable ; \ | ||
+ | if -w /netbsd echo /netbsd: Is writable | ||
+ | /netbsd: Is readable | ||
+ | |||
+ | ... \\ Notice that the '' | ||
+ | |||
+ | ===== Bourne Shell ===== | ||
+ | |||
+ | This includes the original Bourne shell, its derivatives, | ||
+ | |||
+ | A Bourne-shell workalike is available on SDF as ''/ | ||
+ | |||
+ | **Ecl 1:** | ||
+ | |||
+ | $ PATH=/ | ||
+ | / | ||
+ | |||
+ | **Ecl 2:** | ||
+ | |||
+ | $ ls -l `which sh ksh bash` | ||
+ | -r-xr-xr-x | ||
+ | -r-xr-xr-x | ||
+ | -rwxr-xr-x | ||
+ | |||
+ | **Ecl 3:** | ||
+ | |||
+ | $ if test -r /netbsd ; then echo /netbsd: Is readable ; fi ; \ | ||
+ | > if test -w /netbsd ; then echo /netbsd: Is writable ; fi | ||
+ | /netbsd: Is readable | ||
+ | |||
+ | ===== Bourne-Again Shell ===== | ||
+ | |||
+ | The Bourne-Again shell (Bash) was written for the GNU project as a free software replacement for the Bourne shell. Bash can execute the vast majority of Bourne shell scripts without modification. However, its syntax has many extensions that are not present in the Bourne shell. | ||
+ | |||
+ | The Bourne-Again shell is available on SDF as ''/ | ||
+ | |||
+ | |||
+ | **Ecl 1:** | ||
+ | |||
+ | $ PATH=/ | ||
+ | / | ||
+ | |||
+ | **Ecl 2:** | ||
+ | |||
+ | $ ls -l `which sh ksh bash` | ||
+ | -r-xr-xr-x | ||
+ | -r-xr-xr-x | ||
+ | -rwxr-xr-x | ||
+ | |||
+ | **Ecl 3:** | ||
+ | |||
+ | $ if test -r /netbsd ; then echo /netbsd: Is readable ; fi ; \ | ||
+ | > if test -w /netbsd ; then echo /netbsd: Is writable ; fi | ||
+ | /netbsd: Is readable | ||
+ | |||
+ | |||
+ | ===== Z Shell ===== | ||
+ | |||
+ | The Z shell (Zsh) is an extended Bourne shell with many improvements. Paul Falstad wrote the first version of Zsh in 1990 at Princeton University. | ||
+ | |||
+ | The Z shell is available on SDF as ''/ | ||
+ | |||
+ | |||
+ | **Ecl 1:** | ||
+ | |||
+ | % PATH=/ | ||
+ | / | ||
+ | |||
+ | **Ecl 2:** | ||
+ | |||
+ | % ls -l `which csh tcsh zsh` | ||
+ | -r-xr-xr-x | ||
+ | -r-xr-xr-x | ||
+ | -r-xr-xr-x | ||
+ | |||
+ | **Ecl 3:** | ||
+ | |||
+ | % if test -r /netbsd ; then echo /netbsd: Is readable ; fi ; \ | ||
+ | > if test -w /netbsd ; then echo /netbsd: Is writable ; fi | ||
+ | /netbsd: Is readable | ||
+ | |||
+ | ===== C Shell ===== | ||
+ | |||
+ | This includes the original C shell, its derivatives, | ||
+ | |||
+ | The C shell is available on SDF as ''/ | ||
+ | |||
+ | **Ecl 1:** | ||
+ | |||
+ | % setenv PATH / | ||
+ | / | ||
+ | |||
+ | **Ecl 2:** | ||
+ | |||
+ | % ls -l `which csh tcsh zsh` | ||
+ | -r-xr-xr-x | ||
+ | -r-xr-xr-x | ||
+ | -r-xr-xr-x | ||
+ | |||
+ | **Ecl 3:** | ||
+ | |||
+ | % if (-r /netbsd) echo /netbsd: Is readable ; \ | ||
+ | if (-w /netbsd) echo /netbsd: Is writable | ||
+ | /netbsd: Is readable | ||
+ | |||
+ | ===== Other Shells ===== | ||
+ | |||
+ | This section will include information about the Z shell, [[plan_9_9front# | ||
+ | |||
+ | ===== Conclusion ===== | ||
+ | |||
+ | Expand on the differences/ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | UNIX® is a registered trademark of [[http:// | ||