Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!think.com!mintaka!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.shell Subject: Re: shells? Message-ID: <1991Apr17.101443.4196@athena.mit.edu> Date: 17 Apr 91 10:14:43 GMT References: <1455@irit.irit.fr> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 34 In article <1455@irit.irit.fr>, pfeiffer@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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710