shell中如何处理10个以上的参数 [英] How to handle more than 10 parameters in shell
本文介绍了shell中如何处理10个以上的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 linux 上使用 bash shell 并且想在 shell 脚本中使用 10 多个参数
I am using bash shell on linux and want to use more than 10 parameters in shell script
推荐答案
使用花括号将它们分开:
Use curly braces to set them off:
echo "${10}"
您也可以像这样迭代位置参数:
You can also iterate over the positional parameters like this:
for arg
或
for arg in "$@"
或
while (( $# > 0 )) # or [ $# -gt 0 ]
do
echo "$1"
shift
done
这篇关于shell中如何处理10个以上的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文