如果我这样做,我有一个非常奇怪的问题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
.