如何从cygwin shell脚本中的列表中回显字符串

时间:2013-06-11 02:14:44

标签: bash shell cygwin echo csh

seven="( . 1 . 1 . 1)"
octal="zero one two three four five six seven"

for n in $octal
do
   echo $n
done

当它达到七时,它回声“七”。如何让它回显( . 1 . 1 . 1)的字符串$seven

1 个答案:

答案 0 :(得分:4)

seven="( . 1 . 1 . 1)"
octal="zero one two three four five six seven"

for n in $octal
do
   echo "${!n:-$n}"
done