我有一个字符串
server.ip=192.168.1.200
而且我需要把上面的语句完全写入文件中。
如何才能做到这一点?
这就是我正在尝试做的...
set client_config = xmlrpc_server.properties
echo 'serverurl=http://'${IP}':8000' >> %${client_config}%
echo 'port=/RPC2' >> %${client_config}%
它不会被添加到文件中。
最佳答案
这对我有用
$ FOO="192.168.1.1"
$ echo "serverurl=http://$FOO:8000" >> x.conf
$ more x.conf
serverurl=http://192.168.1.1:8000
我正在使用 zsh。我也用 bash 验证过。当你这样做时,你会遇到什么问题?
关于Shell 脚本 + 写入文件字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1973420/