echo相关
#!/bin/csh
echo "Hello World!"
echo "How are you today?"
will produce the output
Hello World!
How are you today?
But the script
#!/bin/csh
echo -n "Good morning, " #不换行输出
echo "Beatrice."
produces:
Good morning, Beatrice.
从键盘输入参数
- 脚本
#!/bin/csh
set uname = $<
echo "Why, Good Morning, $uname!"
echo "Please input your name: "
switch-case
#!/bin/csh
echo -n "Please enter your first name: "
set uname = $<
switch ($uname)
case [Gg]eorge:
cat /messages/George
breaksw
case [Mm]ary:
cat /messages/Mary
breaksw
case [Ss]andy:
cat /messages/Sandy
breaksw
default:
cat /messages/Goodbye
exit 1
endsw
if
#!/bin/csh
if ($#argv == 0) echo There are no arguments
if ($#argv != 0) echo There are $#argv arguments
#!/bin/csh
foreach i (*)
if (-f $i) then