开发者

Shell Script + Write to File a String

I have a string

server.ip=192.168.1.200

And I need to write the above statement completely into the file.

How can this be done?

This is what I'm trying 开发者_如何学Pythonto do...

set client_config = xmlrpc_server.properties
echo 'serverurl=http://'${IP}':8000' >> %${client_config}%
echo 'port=/RPC2' >> %${client_config}%

It doesn't get added to the file.


This worked for me

$ FOO="192.168.1.1"
$ echo "serverurl=http://$FOO:8000" >> x.conf
$ more x.conf
serverurl=http://192.168.1.1:8000

I'm using zsh. I verified it with bash as well. What's the problem you get when you do this?


echo 'server.ip=192.168.1.200' > file in BASH.


Or

set filename=yourfile.txt
echo server.ip=192.168.1.200 >> %filename%
type yourfile.txt

If you need that line to be appended into a file. Note that double >>


client_config = xmlrpc_server.properties
echo "serverurl=http://${IP}:8000" >> $client_config
echo "port=/RPC2" >> $client_config

The above mentioned stuff worked. Thanks for the help folks!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜