[nzlug] Variables??
Martin D Kealey
martin at kurahaupo.gen.nz
Thu Feb 1 09:13:42 NZDT 2007
On Thu, 1 Feb 2007, Nevyn wrote:
> Anyway, I've got an environment variable which has the following value in it:
> 192.168.0.247 4242 22
>
> I want just the ip address so I did something along the lines of:
> echo $SSH_CLIENT | cut -d ' ' -f 1 -
> ... I'm trying to figure out how to get this as an environment variable.
How about a less complicated way:
echo ${SSH_CLIENT%%' '*}
or
SOURCE_IP=${SSH_CLIENT%%' '*}
export SOURCE_IP # (if you need this)
-Martin
--
"War against Terrorism" is an oxymoron
More information about the NZLUG
mailing list