我有
./script "test\42"
以下是一个示例脚本:
#!/bin/sh
echo "$1"
它给了我:
test" (42 being interpreted as an ASCII octal value, 42 = ")
如何显示
test\42 (instead test" ?)
借助tr(翻译Unix命令)?
答案 0 :(得分:0)
尝试使用单引号:
./script 'test\42'
或逃避斜线:
./script "test\\42"