[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text output with ip-up...



DarkChyld [Ronald J. Hall] wrote:
>   Hi, I'm trying to use ip-up (and eventually ip-down) with my Mint setup.
>   Basically, I'm trying to output my logon stats (such as ip address) to a
>   text file /var/log/ip-log. Here is what I've done (but isn't working)

> $4 > /var/log/ip-log

Katherine L Ellis wrote:
> cat $LOCALIP >/var/log/ip-log

You probably want :

	echo $4 > /var/log/ip-log

If you have :

	$4 > /var/log/ip-log

the variable will be interpreted and the shell will try to run a command
with the name of your IP address and put the output from that into the
ip-log file.

If you have :

	cat $LOCALIP >/var/log/ip-log

the variable will be interpreted and cat will try to concatenate the file
with the name of your ip address.

You could also use :

	echo $4 >> /var/log/ip-log

if you don't want the file to be overwritten each time (probably not in
this case), or :

	echo $4 > /var/log/ip-log 2>&1

to get standard error to go into the file as well as standard out.

J

-- 
"Railways have always been plagued by politicians, and it is not hard to
think that Robert Stephenson had the right idea when he drove his engine
over one of them at the opening of the Liverpool & Manchester Railway"