LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-15-2005, 09:39 AM   #1
gururaj
LQ Newbie
 
Registered: Apr 2005
Posts: 13

Rep: Reputation: 0
hostname


hi
In a shell script i need to get the hostname
what is the command to get the hostname

thanks in advance
guru
 
Old 11-15-2005, 09:46 AM   #2
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Erm, "hostname"...
 
Old 01-05-2006, 05:02 PM   #3
rey_ross
LQ Newbie
 
Registered: Jan 2006
Posts: 1

Rep: Reputation: 0
hostname

Itīs quite easy:

Just assign the output of the command *hostname* to a variable:

HOSTNAME=`hostname` ---> using backquotes

if you wanted to see the value of the variable, just type:

echo $HOSTNAME



bye.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hostname avenolpey Debian 2 08-01-2005 09:11 AM
hostname changes R153-Ab0V3 Linux - Newbie 6 01-10-2004 11:36 PM
Hostname jpauls104 Slackware 5 07-28-2003 12:16 PM
Hostname _maco_ Linux - General 3 07-07-2003 07:44 PM
hostname command vs. $HOSTNAME env. variable Silly22 Linux - Networking 2 03-29-2002 05:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration