2 shell questions before the new year
Jeff Damens
US.JD%CU20B at COLUMBIA.ARPA
Sat Dec 29 09:48:52 AEST 1984
> 1. What is the difference between
>
> sh < file
> and
> sh file
With the "sh file" form, standard input can still be redirected
(that is, standard input for any programs that are invoked by
the shell; obviously the shell takes its input from file); the
"sh < file" form doesn't allow input redirection.
> 2. Why begin a shell script with
>
> #!/bin/sh
> or
> #!/bin/csh
This tells the C shell which shell is supposed to interpret the
shell script. It's necessary because the syntax of shell
commands is different in the two shells; I think /bin/sh is used
by default. However, if the script starts with a # and doesn't
have the ! construct, the C shell is used
Jeff Damens, Systems Integration Group, Columbia U.
-------
More information about the Comp.unix
mailing list