Beruflich Dokumente
Kultur Dokumente
EXPLANATION/EXAMPLE
----------------------------Comment line
Display xxxxx; skips to next line.
Displays xxxxx but does not skip.
Exit from the shell script.
Repeat command n times (e.g., to skip 3 lines:
repeat 3 echo " ").
formal arguments
variables
set var=expression
`command`
set var=$<
switch ...
C switch statement.
foreach (<list>)
<body>
end
while (<condition>)
<body>
end
Page 1 of 4
NOTES:
(1)
(2)
(3)
(4)
The first line directs Unix to use the C shell (there are others,
such as Korn, Bourne, etc.)
Giving the file name ensures the wrong file is not used.
Briefly state the purpose played by the shell script.
Invocation gives the pattern for how to call the script. Give
symbolic names that clarify what the arguments are.
Example:
(5)
(6)
(7)
Page 2 of 4
The shell script file must have EXECUTE permissions set (using
chmod).
(2)
(3)
(4)
Make sure your Unix environment executes shell scripts within the
directory in which the script is invoked:
a. View the ~/.cshrc file: % more ~/.cshrc
b. If the line "cp " is near the end of the file, you need to
COMMENT IT OUT ("#cp"). Otherwise, all shell scripts would
execute in your HOME DIRECTORY.
Page 3 of 4
under cis4910joe,
% ShowNames.csh
% Enter your first name: Billy
% Enter your last name: Bob
My Unix login ... cis4910joe
My given name ... Billy Bob
Page 4 of 4