Linux set的妙用

        Linux中的shell命令除了可以在调试shell脚本的时候起到作用,在设定脚本的参数也大有用途。例如:可以向脚本传入一些固定参数,来测试脚本的正确与否。

#!/bin/bash
test()
{
  set "hello" "joking"
  while [ $# -ne 0 ]
  do
     echo $1
     shift
  done
}
test
 

猜你喜欢

转载自bestchenwu.iteye.com/blog/1076121