查询手册
菜鸟教程
for循环和seq的使用
echo "method 1" for i in `seq 1 10`; do echo $i; done 12345
echo "method 2" for i in {1..10} do echo $i; done 12345
echo "method 3" for i in `seq 1 2 10`; do echo $i; done 12345
进入目录创建文件重定向内容
cd Test touch test.sh echo "This is the test for test.sh ">test.sh 123
关于函数的使用
如果函数内部没有参数就返回最后一条执行的结果
function Platform() { echo $(uname) } function Pwd() { echo $(PWD) } function main() { type=`Platform` echo "Platform:"${type} echo "#####" echo ${PWD} } main
12345678910111213141516171819202122运行结果
Platform:Darwin ##### /Users/kouhz/Code/Shell 123