【发布时间】:2019-02-03 14:36:30
【问题描述】:
到目前为止,我已经有一天的 bash 经验..
string () {
for (( i=0; i<${#1}; i++ ))
do
echo "$"${1:$i:1}""
done
}
string "hello"
此脚本返回“$h”、“$e”、“$l”、“$l”、“$o”、
但我实际上希望它返回变量h、e、l、l 和o 的内容。
我该怎么做?
【问题讨论】: