Tess
Tess

Reputation: 19

Bash shell script to echo hostname and kernel version

     `hn = 'hostname'
      echo "Hostname: $hn"`

This is what I did for the kernel version as well, but this is giving me a two line output with the hostname on top and then "Hostname:" below. So how do I get the output to be "Hostname: " ?

Upvotes: 0

Views: 1056

Answers (1)

ZYX Rhythm
ZYX Rhythm

Reputation: 73

$(hn=`hostname`; echo "Hostname: $hn")

or a more human readable format:

$(hn=$(hostname); echo "Hostname: $hn")

Upvotes: 1

Related Questions