Operating System - HP-UX
1822497 Members
2483 Online
109642 Solutions
New Discussion юеВ

advantages of sh and csh ksh

 
Kgreen
Advisor

advantages of sh and csh ksh

Hi I would like to know what are the advantages and disadvantages of having a users shell as /usr/bin sh ksh and csh
4 REPLIES 4
Michal Toth
Regular Advisor

Re: advantages of sh and csh ksh

sh csh ksh bash tcsh zsh rc es
Job control N Y Y Y Y Y N N
Aliases N Y Y Y Y Y N N
Shell functions Y(1) N Y Y N Y Y Y
"Sensible" Input/Output redirection Y N Y Y N Y Y Y
Directory stack N Y Y Y Y Y F F
Command history N Y Y Y Y Y L L
Command line editing N N Y Y Y Y L L
Vi Command line editing N N Y Y Y(3) Y L L
Emacs Command line editing N N Y Y Y Y L L
Rebindable Command line editing N N N Y Y Y L L
User name look up N Y Y Y Y Y L L
Login/Logout watching N N N N Y Y F F
Filename completion N Y(1) Y Y Y Y L L
Username completion N Y(2) Y Y Y Y L L
Hostname completion N Y(2) Y Y Y Y L L
History completion N N N Y Y Y L L
Fully programmable Completion N N N N Y Y N N
Mh Mailbox completion N N N N(4) N(6) N(6) N N
Co Processes N N Y N N Y N N
Builtin artithmetic evaluation N Y Y Y Y Y N N
Can follow symbolic links invisibly N N Y Y Y Y N N
Periodic command execution N N N N Y Y N N
Custom Prompt (easily) N N Y Y Y Y Y Y
Sun Keyboard Hack N N N N N Y N N
Spelling Correction N N N N Y Y N N
Process Substitution N N N Y(2) N Y Y Y
Underlying Syntax sh csh sh sh csh sh rc rc
Freely Available N N N(5) Y Y Y Y Y
Checks Mailbox N Y Y Y Y Y F F
Tty Sanity Checking N N N N Y Y N N
Can cope with large argument lists Y N Y Y Y Y Y Y
Has non-interactive startup file N Y Y(7) Y(7) Y Y N N
Has non-login startup file N Y Y(7) Y Y Y N N
Can avoid user startup files N Y N Y N Y Y Y
Can specify startup file N N Y Y N N N N
Low level command redefinition N N N N N N N Y
Has anonymous functions N N N N N N Y Y
List Variables N Y Y N Y Y Y Y
Full signal trap handling Y N Y Y N Y Y Y
File no clobber ability N Y Y Y Y Y N F
Local variables N N Y Y N Y Y Y
Lexically scoped variables N N N N N N N Y
Exceptions N N N N N N N Y



Key to the table above.

Y Feature can be done using this shell.

N Feature is not present in the shell.

F Feature can only be done by using the shells function
mechanism.

L The readline library must be linked into the shell to enable
this Feature.


source: comp.unix.shell ; faqs.org
Matti_Kurkela
Honored Contributor

Re: advantages of sh and csh ksh

/usr/bin/sh is POSIX standard compliant shell, which means all modern Unix systems may be trusted to have something very much like it. It is based to the classic Bourne shell.
http://en.wikipedia.org/wiki/Bourne_shell


+ when you write scripts using it, the scripts should be portable to other Unix variants with less effort

- when you use a shell interactively (usually most of the time you think as "using a shell"), the more advanced shells have more convenience features than the standard shell


/usr/bin/csh is a shell that uses conventions similar to the C programming language.
http://en.wikipedia.org/wiki/C_shell

- it is definitely NOT compatible with the classic Bourne shell and its descendants

- its design has some fundamental problems: there are things you cannot do with C shell syntax. The traditional "C shell programming considered harmful" posting can be found here: http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

* if you (or your users) really want a csh-like shell for interactive use, consider installing a "Tenex C shell" (tcsh), a descendant of csh with backwards compatibility and some flaws fixed.


/usr/bin/ksh is known as the Korn shell.
http://en.wikipedia.org/wiki/Korn_shell

+ it is very much backwards compatible to the classic Bourne shell, was the basis of the POSIX shell standard and offers some extensions above and beyond that

- before year 2000 it used to be AT&T proprietary software, so it may not be as widely-known than other shells
MK
Bill Hassell
Honored Contributor

Re: advantages of sh and csh ksh

csh is virtually useless due to the many incompatibilities and limitations. The /usr/bin/sh shell is the POSIX shell, virtually identical to ksh (also a POSIX standard shell), so either is a reasonable shell to learn and use. Note that /usr/bin/ksh is ksh88 (fairly old) while /usr/dt/bin/dtksh is ksh93 standard. dtksh has Xwindow programming enhancements.

Bash is also a POSIX shell that is very much like sh and ksh with a few enhancements. Bash must be downloaded as it is not supplied with the OS.

In HP-UX, /usr/bin/sh is the POSIX shell while /usr/old/bin/sh is the Bourne shell, a small subset of POSIX shells and not recommended for today's scripting. POSIX shells are by far the most portable scripting language for Unix followed by Perl.


Bill Hassell, sysadmin
Steven E. Protter
Exalted Contributor

Re: advantages of sh and csh ksh

Shalom,

the right tool for the right job. Bourne and c are provided and a I know of a few third party apps that need those shells to install and start.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com