D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] bash shell script question

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am trying to create a .bashrc script that will (among other things)
display my IP address at  upon login.

echo "hostname: "; hostname -I

This line works but displays the ipaddress on the next line down, I
want it to print

Hostname : 192.168.x.x

if I try and use a comma rather than a semi colon it fails.  I was
thinking either the solution is to :

1.  Put the out put to hostname -I as a variable and display that OR
2   put the output as an environment variable e.g $HOSTNAME and
display that

Just not sure on HOW to do this

any help would be great,  thanks

Paul



- -- 
http://www.zleap.net @zleap14
@zleap14  diaspora : zleap@xxxxxxxxxxxxxxxx
Documentation lead @ ToriOS http://www.torios.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlSmy5cACgkQaggq1k2FJq1TMgCdEVLjJ5JTMf9we/U6F+sBTngB
+m8AmwfXyURyIuPatwyJL5orjW5Yhrkf
=Mo+U
-----END PGP SIGNATURE-----

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq