【发布时间】:2012-09-10 07:55:18
【问题描述】:
sed 有一个非常奇怪的问题,如果我这样做的话:
[root@Camel ~]-> sed -i 's/TLRAGENT_IP=.*/TLRAGENT_IP='"${HOST_IP}"'/' ~user/.bash_profile
没关系。但如果我尝试以下操作:
[root@Camel ~]-> CONF_FILE="~user/.bash_profile"
[root@Camel ~]-> sed -i 's/TLRAGENT_IP=.*/TLRAGENT_IP='"${HOST_IP}"'/' ${CONF_FILE}
sed: can't read ~user/.bash_profile: No such file or directory
还尝试引用变量:
[root@Camel ~]-> sed -i 's/TLRAGENT_IP=.*/TLRAGENT_IP='"${HOST_IP}"'/' "${CONF_FILE}"
sed: can't read ~user/.bash_profile: No such file or directory
不知道哪里出了问题,请指教。
Shell 的版本是3.2.25(1)-release。
【问题讨论】:
标签: bash sed home-directory