shells?

Jonathan I. Kamens jik at athena.mit.edu
Wed Apr 17 20:14:43 AEST 1991


In article <1455 at irit.irit.fr>, pfeiffer at irit.fr (Daniel Pfeiffer) writes:
|> compatible.  For example I heard that [ test ] is a built in for ksh.
|> Does that mean we have we can say (without ;):
|> 
|> if [ test ] then
|> while [ test ] do

  No, what it means is that the syntax is the same in ksh as it was for sh,
but rather than invoking the program "test" to do the test, ksh emulates test
internally.

  In other words, if I have

	if [ test ]; then
		... code here ...
	fi

In the bourne shell, a fork and exec would have to take place to run "test" to
perform the test.  In the korn shell, the test is performed in the shell
process.

  If the syntax were changed in order to make tests built-in, then many
/bin/sh scripts would break under ksh (or, at the very least, would not get
the performance advantage of the built-in).

  Csh's echo is similar to this -- when you use "echo" in csh, you are calling
a shell built-in, which pretends to be the separate program "echo", but does
what echo would do without any subprocesses.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.shell mailing list