sh: Bad substitution
rhel6.10 sh脚本能正常执行:
if [ "${i:0:1}" != "/" ]; then
# 条件成立的操作
else
# 条件不成立的操作
fi
但ubuntu18.04失败。
需要修改成如下:
if [ "$(expr substr "$i" 0 1)" != "/" ]; then
# 条件成立的操作
else
# 条件不成立的操作
fi
sh: Bad substitution
rhel6.10 sh脚本能正常执行:
if [ "${i:0:1}" != "/" ]; then
# 条件成立的操作
else
# 条件不成立的操作
fi
但ubuntu18.04失败。
需要修改成如下:
if [ "$(expr substr "$i" 0 1)" != "/" ]; then
# 条件成立的操作
else
# 条件不成立的操作
fi