码迷,mamicode.com
首页 > 其他好文 > 详细

for循环参数列表通过命令行读入

时间:2016-10-16 14:27:25      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:linux shell

 1 #通过命令行来传递脚本中for循环列表参数
  2 #!/bin/bash
  3 
  4 echo "number of arguments is $#"
  5 
  6 echo "What you input is "
  7 
  8 #通过命令行来传递脚本for循环的参数列表
  9 for argument in "$*"
 10 do 
 11     echo "$argument"
 12 done
 
 
 
 
 执行结果
[   ]$ ./forargument.sh 12 34 "love"
number of arguments is 3
What you input is 
12 34 love


for循环参数列表通过命令行读入

标签:linux shell

原文地址:http://11468437.blog.51cto.com/11458437/1862312

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!