#一个login的例子
if ($?path) then 
set path=($HOME/bin $path) 
else 
set path=($HOME/bin /usr/bin .) 
endif 
if ( ! $ {?DT} ); then 
stty dec new 
tset -I -Q 
endif 
set mail=/usr/spool/mail/$USER
#关于if使用的几个例子
#执行一个命令或程序之前,先检查该命令是否存在,然後才执行
if [ -x /sbin/quotaon ] ; then 
echo "Turning on Quota for root filesystem" 
/sbin/quotaon / 
fi
#得到hostname 
#!/bin/sh 
if [ -f /etc/HOSTNAME ] ; then 
HOSTNAME=`cat /etc/HOSTNAME` 
else 
HOSTNAME=localhost 
fi
#如果某个设定档允许有好几个位置的话,例如crontab,可利用if then elif fi来找寻
if [ -f /etc/crontab ] ; then  #[ -f /etc/crontab ]等价于test -f /etc/crontab
CRONTAB="/etc/crontab" 
elif [ -f /var/spool/cron/crontabs/root ] ; then 
CRONTAB="/var/spool/cron/crontabs/root" 
elif [ -f /var/cron/tabs/root ] ; then 
CRONTAB="/var/cron/tabs/root" 
fi 
export CRONTAB
#利用uname来判断目前系统,并分别做各系统状况不同的事。
SYSTEM=`uname -s` 
if [ $SYSTEM = "linux" ] ; then 
echo "Linux" 
elif [ $SYSTEM = "FreeBSD" ] ; then 
echo "FreeBSD" 
elif [ $SYSTEM = "Solaris" ] ; then 
echo "Solaris" 
else 
echo "What?" 
fi
#关于while使用的例子
#无条件循环
while : ; do 
echo "do something forever here" 
sleep 5 
done