| Text-only | Table of Contents (frame/ no frame) |
| (1) What is a shell script |
|
There is no difference in syntax between interactive command line use and placing the commands in a file. Some commands are only useful when used interactively (e.g. command line history recall) and other commands are too complex to use interactively.
#!/path/to/shell (e.g. #!/bin/ksh).
The#!characters tell the system to locate the following pathname, start it up and feed it the rest of the file as input. Any program which can read commands from a file can be started up this way, as long as it recognizes the#comment convention. The program is started, and then the script file is given to it as an argument. Because of this, the script must be readable as well as executable. Examples are perl, awk, tcl and python.
ksh myscript
chmod, it becomes a new command
and available for use (subject to the usual $PATH search).chmod +x myscript
| what.src last modified Mar 18, 2005 | Introduction | Table of Contents (frame/no frame) |
Printable (single file) |
© Dartmouth College |