【发布时间】:2016-04-11 10:46:04
【问题描述】:
我对 shell 脚本并不陌生。我在 shell 脚本中有一个命令,其中包含特殊字符。现在我不知道如何从每个单词中转义特殊字符。
/app/home/apache243/bin/httpd -f /app/apache$ configs/statichost1.conf
如你所见 apache$ configs 有特殊字符和空格。现在我想转义这个命令中的所有特殊字符,除了 /httpd -f / 。现在这个特殊字符可以出现在 /httpd -f / 之前和之后。即它可能是 apache $243 这个或这个 apache! 234@ 。 /httpd -f/ 之前和之后。我想要的在下面
/app/symc/apache243/bin/httpd -f /app/apache\$\ configs/statichost1.conf
【问题讨论】: