bash子串扩展不对

时间:2018-06-08 06:21:51

标签: bash

子串扩展的工作方式与预期不符。

a='123?'
echo $a         #outputs '123?' as expected
echo ${a:3:1}   #outputs '=' not as expected
echo ${a:2:2}   #outputs '3?' as expected
echo "${a:3:1}" #outputs '?' as expected

我无法理解,请帮助我。

0 个答案:

没有答案