views:

65

answers:

4

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 to 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.

+4  A: 

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

Pedro Silva
When I makle the file name a variable, I get an error when trying to do this "ambiguous redirect"
Panther24
Show the code - what is in the file name variable?
Jonathan Leffler
I'm updated my post
Panther24
+1  A: 

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 >>

Rubens Farias
I'm updated my post, please take a look
Panther24
+1  A: 

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?

Noufal Ibrahim
A: 
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!!

Panther24