0
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

4

1 回答 1

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

for n in $octal
do
   echo "${!n:-$n}"
done
于 2013-06-11T02:18:04.317 回答