home *** CD-ROM | disk | FTP | other *** search
/ ftp.disi.unige.it / 2015-02-11.ftp.disi.unige.it.tar / ftp.disi.unige.it / pub / .person / GianuzziV / SysOp / shell.txt < prev   
Text File  |  1996-11-21  |  16KB  |  292 lines

  1.  
  2.         UNIX SHELL DIFFERENCES AND HOW TO CHANGE YOUR SHELL
  3.               Brian Blackmore, bnb@gryphon.demon.co.uk
  4.  
  5.            Archive-name: unix-faq/shell/shell-differences
  6.  
  7.                            Version: 1.06
  8.  
  9. ----------------------------------------------------------------------------
  10.  
  11. Contents
  12.  
  13.    * Modifications since last issue
  14.    * Why change your shell
  15.    * The history of unix shells
  16.    * Deciding on a shell
  17.    * Shell features (table)
  18.    * How to change your shell
  19.    * A warning about changing your shell
  20.    * Further information
  21.    * Copyright and Disclaimer
  22.  
  23. ----------------------------------------------------------------------------
  24.  
  25. MODIFICATIONS SINCE LAST ISSUE
  26.  
  27. I have a new email address, and from around the end of July my old address
  28. will be no more. Email relating to the content of this document should now
  29. be sent to shell-diff@gryphon.demon.co.uk, while any other email should be
  30. sent to bnb@gryphon.demon.co.uk.
  31.  
  32. ----------------------------------------------------------------------------
  33.  
  34. WHY CHANGE YOUR SHELL
  35.  
  36. The UNIX shell is most people's main access to the UNIX operating system and
  37. as such any improvement to it can result in considerably more effective use
  38. of the system, and may even allow you to do things you couldn't do before.
  39. The primary improvement most of the new generation shells give you is
  40. increased speed. They require fewer key strokes to get the same results due
  41. to their completion features, they give you more information (e.g. showing
  42. your directory in your prompt, showing which files it would complete) and
  43. they cover some of the more annoying features of UNIX, such as not going
  44. back up symbolic links to directories.
  45.  
  46. ----------------------------------------------------------------------------
  47.  
  48. A BRIEF HISTORY OF UNIX SHELLS
  49.  
  50. In the near beginning there was the Bourne shell /bin/sh (written by S. R.
  51. Bourne). It had (and still does) a very strong powerful syntactical language
  52. built into it, with all the features that are commonly considered to produce
  53. structured programs; it has particularly strong provisions for controlling
  54. input and output and in its expression matching facilities. But no matter
  55. how strong its input language is, it had one major drawback; it made nearly
  56. no concessions to the interactive user (the only real concession being the
  57. use of shell functions and these were only added later) and so there was a
  58. gap for something better.
  59.  
  60. Along came the people from UCB and the C-shell /bin/csh was born. Into this
  61. shell they put several concepts which were new, (the majority of these being
  62. job control and aliasing) and managed to produce a shell that was much
  63. better for interactive use. But as well as improving the shell for
  64. interactive use they also threw out the baby with the bath water and went
  65. for a different input language.
  66.  
  67. The theory behind the change was fairly good, the new input language was to
  68. resemble C, the language in which UNIX itself was written, but they made a
  69. complete mess of implementing it. Out went the good control of input and
  70. output and in came the bugs. The new shell was simply too buggy to produce
  71. robust shell scripts and so everybody stayed with the Bourne shell for that,
  72. but it was considerably better for interactive use so changed to the C
  73. shell, this resulted in the stupid situation where people use a different
  74. shell for interactive work than for non-interactive, a situation which a
  75. large number of people still find themselves in today.
  76.  
  77. After csh was let loose on an unsuspecting world various people decided that
  78. the bugs really should get fixed, and while they where at it they might as
  79. well add some extra features. In came command line editing, TENEX-style
  80. completion and several other features. Out went most of the bugs, but did
  81. the various UNIX operating system manufacturers start shipping tcsh instead
  82. of csh? No, they stuck with the standard C-Shell.
  83.  
  84. Eventually David Korn from AT&T had the bright idea to sort out this mess
  85. and the Korn shell /bin/ksh made its appearance. This quite sensibly junked
  86. the C shells language and reverted back to the bourne shell language, but it
  87. also added in the many features that made the C shell good for interactive
  88. work (you could say it was the best of both worlds), on top of this, it also
  89. added a some features from other operating. The Korn shell became part of
  90. System V but had one major problem; unlike the rest of the UNIX shells it
  91. wasn't free, you had to pay AT&T for it.
  92.  
  93. It was at about this time that the first attempts to standardize UNIX
  94. started in the form of the POSIX standard. POSIX specified more or less the
  95. System V Bourne Shell (by this time the BSD and System V versions had got
  96. slightly different). Later the standard is upgraded, and somehow the new
  97. standard managed to look very much like ksh.
  98.  
  99. Also at about this time the GNU project was underway and they decided that
  100. they needed a free shell, they also decided that they wanted to make this
  101. new shell POSIX compatible, thus bash (the Bourne again shell) was born.
  102. Like the Korn shell bash was based upon the Bourne shells language and like
  103. the Korn shell, it also pinched features from the C shell and other
  104. operating systems (in my opinion it put them together better; guess which
  105. shell I use), but unlike the Korn shell it is free. Bash was quickly adopted
  106. for LINUX (where it can be configured to perform just like the Bourne
  107. shell), and is the most popular of the free new generation shells.
  108.  
  109. Meanwhile faced with the problem of porting the Bourne shell to Plan 9, Tom
  110. Duff revolts and writes rc, he publishes a paper on it, and Byron Rakitzis
  111. reimplements it under UNIX. Rc ended up smalled, simpler, more regular and
  112. in most peoples opinion a much better programmed shell.
  113.  
  114. The search for the perfect shell still goes on and the latest entry into
  115. this arena is zsh. Zsh was written by Paul Falstad while he was a student a
  116. Princeton and is a feature packed shell which has so many features that I
  117. don't even think the he even knows all of them.
  118.  
  119. ----------------------------------------------------------------------------
  120.  
  121. DECIDING ON A SHELL
  122.  
  123. Which of the many shells you choose depends on many different things, here
  124. is what I consider to be the most important, you may think differently.
  125.  
  126. How much time do I have to learn a new shell?
  127.      There is no point in using a shell with a different syntax, or a
  128.      completly different alias system if you havn't the time to learn it. If
  129.      you have the time and are presently using csh or tcsh it is worth
  130.      considering a switch to a Bourne shell variant.
  131. What do I wish to be able to do with my new shell?
  132.      The main reason for switching shells is to gain extra functionality;
  133.      its vital you know what you are gaining from the switch.
  134. Do I have to be able to switch back to a different shell?
  135.      If you may have to switch back to a standard shell, it is fairly
  136.      important you don't become too dependent on extra features and so can't
  137.      use an older shell.
  138. How much extra load can the system cope with?
  139.      The more advanced shells tend to take up extra CPU, since they work in
  140.      cbreak mode; if you are on an overloaded machine they should probably
  141.      be avoided; this can also cause problems with an overloaded network.
  142.      This only really applies to very old systems nowadays.
  143. What support is given for my new shell?
  144.      If your new shell is not supported make sure you have someone you can
  145.      ask if you encounter problems or that you have the time to sort them
  146.      out yourself.
  147. What shell am I using already?
  148.      Switching between certain shells of the same syntax is alot easier than
  149.      switching between shells of a different syntax. So if you havn't much
  150.      time a simple upgrade (eg csh to tcsh) may be a good idea.
  151. Can I afford any minor bugs?
  152.      Like most software all shells have some bugs in them (especially csh),
  153.      can you afford the problems that may occur because of them.
  154.  
  155. ----------------------------------------------------------------------------
  156.  
  157. SHELL FEATURES
  158.  
  159. This table below lists most features that I think would make you choose one
  160. shell over another. It is not intended to be a definitive list and does not
  161. include every single possible feature for every single possible shell. A
  162. feature is only considered to be in a shell if in the version that comes
  163. with the operating system, or if it is available as compiled directly from
  164. the standard distribution.
  165.  
  166.                                         sh   csh   ksh  bash tcsh zsh  rc
  167. Job control                             N    Y     Y    Y    Y    Y    N
  168. Aliases                                 N    Y     Y    Y    Y    Y    N
  169. Shell functions                         Y(1) N     Y    Y    N    Y    Y
  170. "Sensible" Input/Output redirection     Y    N     Y    Y    N    Y    Y
  171. Directory stack                         N    Y     Y    Y    Y    Y    N
  172. Command history                         N    Y     Y    Y    Y    Y    N(7)
  173. Command line editing                    N    N     Y    Y    Y    Y    N(7)
  174. Vi Command line editing                 N    N     Y    Y    Y(3) Y    N(7)
  175. Emacs Command line editing              N    N     Y    Y    Y    Y    N(7)
  176. Rebindable Command line editing         N    N     N    Y    Y    Y    N(7)
  177. User name look up                       N    Y     Y    Y    Y    Y    N(7)
  178. Login/Logout watching                   N    N     N    N    Y    Y    N
  179. Filename completion                     N    Y(1)  Y    Y    Y    Y    N(7)
  180. Username completion                     N    Y(2)  Y    Y    Y    Y    N(7)
  181. Hostname completion                     N    Y(2)  Y    Y    Y    Y    N(7)
  182. History completion                      N    N     N    Y    Y    Y    N(7)
  183. Fully programmable Completion           N    N     N    N    Y    Y    N
  184. Mh Mailbox completion                   N    N     N    N(4) N(6) N(6) N
  185. Co Processes                            N    N     Y    N    N    Y    N
  186. Builtin artithmetic evaluation          N    Y     Y    Y    Y    Y    N
  187. Can follow symbolic links               N    N     Y    Y    Y    Y    N
  188. Periodic command execution              N    N     N    N    Y    Y    N
  189. Custom Prompt (easily)                  N    N     Y    Y    Y    Y    Y
  190. Sun Keyboard Hack                       N    N     N    N    N    Y    N
  191. Spelling Correction                     N    N     N    N    Y    Y    N
  192. Process Substitution                    N    N     N    Y(2) N    Y    Y
  193. Underlying Syntax                       sh   csh   sh   sh   csh  sh   rc
  194. Freely Available                        N    N     N(5) Y    Y    Y    Y
  195. Checks Mailbox                          N    Y     Y    Y    Y    Y    N(8)
  196. Tty Sanity Checking                     N    N     N    N    Y    Y    N
  197. Can cope with large argument lists      Y    N     Y    Y    Y    Y    Y
  198. Has non-interactive startup file        N    Y     Y(9) Y(9) Y    Y    N
  199. Has non-login startup file              N    Y     Y(9) Y    Y    Y    N
  200. Can avoid user startup files            N    N     N    Y    N    Y    Y
  201. Can specify startup file                N    N     Y    Y    N    N    N
  202.  
  203. Notes to the table above
  204.  
  205.   1. This feature was not in the orginal version, but has since become
  206.      almost standard.
  207.   2. This feature is fairly new and so is often not found on many versions
  208.      of the shell, it is gradually making its way into standard
  209.      distribution.
  210.   3. The Vi emulation of this shell is thought by many to be incomplete.
  211.   4. This feature is not standard but unoffical patches exist to perform
  212.      this.
  213.   5. A version called 'pdksh' is freely available, but does not have the
  214.      full functionality of the AT&T version.
  215.   6. This can be done via the shells programmable completion mechanism.
  216.   7. A library can be linked into the shell to provide this feature.
  217.   8. This can be done via the shells prompt function.
  218.   9. Only by specifing a file via the ENV environment variable.
  219.  
  220. ----------------------------------------------------------------------------
  221.  
  222. HOW TO CHANGE YOUR SHELL
  223.  
  224. If you ever look at a UNIX manual page it will say that to change your shell
  225. use chsh or passwd -s; unfortunately it often isn't as simple as this, since
  226. it requires that your new shell is recognized as a valid shell by the system
  227. and at present many systems do not recognize the newer shells (the normal
  228. selection is, /bin/sh, /bin/csh and possibly /bin/ksh). You are thus left
  229. with having to do some sort of fudge, changing your effective login shell
  230. without changing your official entry in /etc/passwd. You may also be left
  231. with the problem that there isn't a compiled binary on your system , so you
  232. will have to get hold of the shell's source and compile it yourself (Its
  233. generally best to ask around to see if anyones done this already, since it
  234. isn't that easy). Once done you should add in code to your old shells login
  235. file so that it overlays your official login shell with your new shell
  236. (remember to add the login flags to the command line, and with csh/tcsh
  237. ensure that the overlay doesn't happen recursively since they both read the
  238. same .login file).
  239.  
  240. The shell can be recognized as a valid shell if the system administrator
  241. puts it in the file /etc/shells. If this file does not exist, it must be
  242. created and should contain all valid shells (i.e.don't forget the
  243. traditional ones in all their forms).
  244.  
  245. ----------------------------------------------------------------------------
  246.  
  247. A WARNING ABOUT CHANGING YOUR SHELL
  248.  
  249. If you do decide to change your shell you must be very careful - if handled
  250. wrongly it can be almost impossible to correct, and will almost certainly
  251. cause you a lot of hassle. Never make a new shell a login shell until you
  252. have tested its new configuration files thoroughly and then tested them once
  253. again. It is also important that you make a full backup of your previous
  254. config files onto a floppy disk (or a different host if you have a second
  255. account) if you have to change any of them (which you will probably have to
  256. do if you can't change your shell entry in /etc/passwd). You should also
  257. note that your new shell is probably not supported by your system admin, so
  258. if you have any problems you will probably have to look elsewhere.
  259.  
  260. ----------------------------------------------------------------------------
  261.  
  262. FURTHER INFORMATION
  263.  
  264. The Bourne shell, the C-Shell and the Korn Shell (if you have it) are all
  265. distributed as standard with your UNIX operating system, information on
  266. these should come with your operating system, bug reports etc should be sent
  267. to your operating system vendor.
  268.  
  269. Bash was written and is maintained by the Free Software Foundation, the
  270. primary source of information for this shell is its manual page. Bug reports
  271. should be sent to bash-maintainers@ai.MIT.Edu, while suggestions and
  272. philosophical bug reports may be mailed to bug-bash@ai.MIT.Edu or posted to
  273. the Usenet newsgroup gnu.bash.bug, the source is widely available on many
  274. ftp sites, and is subject to the GNU copyleft licence.
  275.  
  276. Rc is available by ftp from ftp:viz.tamu.edu/pub/rc and several other
  277. places. An FAQ exists and is posted frequently to comp.unix.shell and other
  278. places. The Rc mailing list may be subscribed to by sending mail to
  279. rc-request@hawkwind.utcs.toronto.edu, this, the manual page and the Rc FAQ
  280. are the main sources of information for this shell.
  281.  
  282. Zsh is now maintained by the zsh mailing list, which can be subscribed to by
  283. sending email to Majordomo@sterling.com containing subscribe zsh-list, there
  284. is also an FAQ which is posted frequently to comp.unix.shell. The manual
  285. page, the Z-shell FAQ and the zsh-list are the main sources of information
  286. for this shell.
  287.  
  288. Questions on any of the UNIX shells and on shell script programming, may be
  289. posted to the Usenet newsgroup comp.unix.shell a quick response can normally
  290. be expected, especially on subjects relating to the more common shells.
  291.  
  292.