Linux tr 命令“构造错位”失败。
这段代码工作正常,但最近开始失败。
我们还看到,字符串 Y 在那里。不知道这是从哪里来的。
代码:
if [ "${V_INSTANCE_CODE}" = "" ];
then
V_INSTANCE_CODE="A1"
fi
V_INSTANCE_CODE_LWR=`echo ${V_INSTANCE_CODE} | tr [[:upper:]] [[:lower:]]`
错误系统输出日志:
+ V_INSTANCE_CODE=''
+ [ '' '=' '' ]
+ V_INSTANCE_CODE=A1
+ echo A1
+ tr Y '[[:lower:]]'
tr: misaligned [:upper:] and/or [:lower:] construct
+ V_INSTANCE_CODE_LWR=''
最佳答案
tr '[[:upper:]]' '[[:lower:]]'
关于Linux tr 命令失败 "misaligned construct",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55355552/