一、语法说明
sh [-nvx] scripts.sh(程序名)
选项与参数:
-n:不需要运行scripts,仅查询语法的问题
-v:在运行scripts前,先讲scripts的内容输出到屏幕上
-x:将使用到的scripts内容显示在屏幕上
二、实例
范例一:测试 sh16.sh 有无语法的问题? [root@www ~]# sh -n sh16.sh # 若语法没有问题,则不会显示任何资讯! 范例二:将 sh15.sh 的运行过程全部列出来~ [root@www ~]# sh -x sh15.sh + PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin + export PATH + for animal in dog cat elephant + echo 'There are dogs.... ' There are dogs.... + for animal in dog cat elephant + echo 'There are cats.... ' There are cats.... + for animal in dog cat elephant + echo 'There are elephants.... ' There are elephants....