- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Display DNS names as a prompt
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
Discussions
Discussions
Forums
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
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
тАО02-23-2007 03:04 AM
тАО02-23-2007 03:04 AM
I want the DNS name to get printed in the prompt of the HP-UX machine.
If the dns name of the machine is a.it.com then the prompt should look like
a.it.com >
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2007 03:07 AM
тАО02-23-2007 03:07 AM
Re: Display DNS names as a prompt
and welcome to the forums !
You can set with:
export PS1='a.it.com >'
Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33 on how to reward any useful answers given to your questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2007 03:07 AM
тАО02-23-2007 03:07 AM
Re: Display DNS names as a prompt
If you add this to your '.profile' (Posix or Korn) shell assumed, you will display the server hostname.
# PS1=`hostname`" # "
Of course, change '#' to '$' for non-root accounts to differentiate them.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2007 03:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2007 03:12 AM
тАО02-23-2007 03:12 AM
Re: Display DNS names as a prompt
I missed a closing ) in my command above. It should be:
HOST=$(nslookup $(hostname) | grep Name: | awk '{print $2}')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2007 03:19 AM
тАО02-23-2007 03:19 AM
Re: Display DNS names as a prompt
I am able to get that now. i just wanted to know one more thing. In TRU64,
export PS1="`uname -n >"
solves the problem. It doesnt work the same way in HP-UX?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2007 03:23 AM
тАО02-23-2007 03:23 AM
Re: Display DNS names as a prompt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2007 03:36 AM
тАО02-23-2007 03:36 AM
Re: Display DNS names as a prompt
In my mind the DNS name is different from the hostname or 'uname -n' output.
Your example shows the fully qualified 'a.it.com' which you typically don't see from 'uname -n' or hostname.
So, which do you want?
If you just want the 'uname -n' ouput you can try:
export PS1="$(uname -n) >"
(Note the use of the $() to run commands instead of the `` (backticks). The $() is much easier to read and does the same thing.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-23-2007 05:29 AM
тАО02-23-2007 05:29 AM
Re: Display DNS names as a prompt
> In TRU64, export PS1="`uname -n >" solves the problem.
Well, while each Unix has some minor differences, each variation has a common ancestor. Had you provided the closing backtick (after '-n') (and perhaps quickly examined the manpages) *and* then tried your syntax at the commnad line, you would have answered and solved your own problem. Experimentation = learning.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2007 12:02 AM
тАО03-29-2007 12:02 AM