- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Shell Script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 10:21 AM
05-28-2002 10:21 AM
Can any one tell me, is there any command to get the full hostname other than nslookup?. When I type "echo $DISPLAY", it gives "xyz:10.0", but I need to export the DISPLAY variable to xyz.tt.nt.com:10.0 (with the full hostname).
Thanks
Vasu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 10:30 AM
05-28-2002 10:30 AM
Re: Shell Script
Will hostname give you what you want?
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 10:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 10:43 AM
05-28-2002 10:43 AM
Re: Shell Script
you can put the full qualified domain name together with command substitution and a variable:
variable=`hostname``domainname`
(use backticks here everywhere to get it work)
echo $var
--> will deliver you the FQDN of that host
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 10:54 AM
05-28-2002 10:54 AM
Re: Shell Script
Otherwise is unlikely that you get a standard way to get the full qualified host name or address. My experience is that usually domainname gives you blank. Admin seldom care to initialize it properly and in these times of LDAP, yp is not so popular...
If you need to inform DISPLAY I think that combining hostname and nslookup will do the job. Otherwise you can inspect /etc/hosts, but you can end up looking up a mere 127.0.0.1 localhost.
Since there is no host command, my advice is
(sorry) nslookup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 10:58 AM
05-28-2002 10:58 AM
Re: Shell Script
# cat /etc/hosts | grep `hostname` | awk '{print $3}'
just a thought ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 11:38 AM
05-28-2002 11:38 AM
Re: Shell Script
It won't give you the full output, but
# who -mT
should do the trick
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 11:45 AM
05-28-2002 11:45 AM
Re: Shell Script
hsotname is the command.
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 12:04 PM
05-28-2002 12:04 PM
Re: Shell Script
Here is what I put into scripts for exporting displays:
export DISPLAY=`who -mT | awk '{print $9}'`:0.0
Hope this helps
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2002 12:17 PM
05-28-2002 12:17 PM
Re: Shell Script
DISPLAY=12.34.56.78:0.0
By setting the IP address, you are assured of zero problems with name resolution.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2002 04:49 AM
05-29-2002 04:49 AM
Re: Shell Script
Try the following as a slightly more robust solution.
HOST=$(hostname)
CURRENT_IP=$(getip $HOST)
export DISPLAY=$CURRENT_IP:0.0
Of course these can be combined into one line...
Curious: What can't you use DNS?
If DNS cannot be used, you may try placing host in question in the /etc/hosts, ensuring that files is before DNS in your nsswitch.conf
Glenn