たとえば$(${StrVar})
、私は、私はStrVar
価値があります$
。test$9hp
。
コマンドを実行すると、$(${StrVar}
私の変数内で失敗し、$9
拡張を試みます。
function Deploy
{
# in this function
output=$(echo ${1})
echo "$output"
}
Deploy "test$9hp"
埋め込み文字列値の実行を防ぐ方法は$9
?
ベストアンサー1
Deploy "test\$9gh"
を使用すると、set -x
スクリプトに次のように表示されます。
+ Deploy 'test$9hp'
++ echo 'test$9hp'
+ output='test$9hp'
+ echo 'test$9hp'
test$9hp
+ set +x
拡張されません。