在UNIX外壳阵列? [英] Arrays in unix shell?
本文介绍了在UNIX外壳阵列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何创建UNIX shell脚本数组?
How do I create an array in unix shell scripting?
推荐答案
在bash中,您将创建阵列像这样
in bash, you create array like this
arr=(one two three)
调用元素
$ echo ${arr[0]}
one
$ echo ${arr[2]}
three
,要求用户输入,您可以使用阅读
to ask for user input, you can use read
read -p "Enter your choice: " choice
是你问的?
这篇关于在UNIX外壳阵列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文