只是pesuocode,但这基本上是我想做的.
Array=("1" "Linux" "Test system"
"2" "Windows" "Workstation"
"3" "Windows" "Workstation")
echo "number " ${array[search "$1"]} "is a" ${array[search "$1" +1]} ${array[search "$1" +2])}
Run Code Online (Sandbox Code Playgroud)
这可能与bash有关吗?我只能找到有关搜索和替换的信息.我没有看到任何可以返回和索引的东西.