如何处理外壳10多个参数 [英] How to handle more than 10 parameters in shell

查看:103
本文介绍了如何处理外壳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

这篇关于如何处理外壳10多个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆