D&C GLug - Home Page

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

Re: [LUG] bash shell script question

 

On Fri, Jan 02, 2015 at 04:57:53PM +0000, Martijn Grooten wrote:
> On Fri, Jan 02, 2015 at 04:47:41PM +0000, Paul Sutton wrote:
> > 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
> 
>   hostname=`hostname -I`; echo "Hostname: $hostname"

Actually,

  echo "hostname:" `hostname -I`

is much better, and is a proper answer to 1.

Martijn.

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