- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: PROBLEM WITH PROMPT AND HOUR
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-26-2005 08:26 PM
05-26-2005 08:26 PM
=====================================
typeset -RZ2 _x1 _x2 _x3
let SECONDS=$(date '+3600*%H+60*%M+%S')
_s='(_x1=(SECONDS/3600)%24)==(_x2=(SECONDS/60)%60)==(_x3=SECONDS%60)'
TIME='"${_d[_s]}$_x1:$_x2:$_x3"'
export PS1=`hostname`"[$TIME]:\$PWD> "
=====================================
The problem was the following:
If I logging in with my personal user account it work and the prompt was displayed correctly.
If logging in with root account I wasn't able to have the right prompt.
EXAMPLES:
For my ACCOUNT
myhost[10:36:41]:/home/myuser>
For root ACCOUNT:
myhost["${_d[_s]}$_x1:$_x2:$_x3"]:$PWD>
P.S.: Both the user are useing the same SHELL: /sbin/sh
Thanks for any help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 08:32 PM
05-26-2005 08:32 PM
Re: PROBLEM WITH PROMPT AND HOUR
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 08:37 PM
05-26-2005 08:37 PM
Re: PROBLEM WITH PROMPT AND HOUR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 08:57 PM
05-26-2005 08:57 PM
Re: PROBLEM WITH PROMPT AND HOUR
You must quote all like this:
export PS1="`hostname`# ..."
Or else, you are changing the hostname...
Best Regards,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 08:57 PM
05-26-2005 08:57 PM
Re: PROBLEM WITH PROMPT AND HOUR
/etc/profile
PS1=`$(hostname)[(date +'%H:%M:%S')]:$PWD>'
export $PS1
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 08:58 PM
05-26-2005 08:58 PM
Re: PROBLEM WITH PROMPT AND HOUR
PS1='$(hostname)[(date +'%H:%M:%S')]:$PWD>'
` came instead of '.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 09:24 PM
05-26-2005 09:24 PM
Re: PROBLEM WITH PROMPT AND HOUR
export PS1=`hostname`[`date +%H:%M:%S`]:\$PWD
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 09:31 PM
05-26-2005 09:31 PM
Re: PROBLEM WITH PROMPT AND HOUR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 09:45 PM
05-26-2005 09:45 PM
Re: PROBLEM WITH PROMPT AND HOUR
For Eric:
I've quoted everything but it didn0t works.
For Muthukumar:
I tried to put the script in the /etc/profile but it work for my user account and not for root account.
The prompt that you have suggested me didn't update the date every time that you execute a command and the prompt come back.
My prompt should be like this:
myhost[10:10:10]/home/myuser> cd ..
myhost[10:10:14]/home>cd myuser
myhost[10:10:19]/home/myuser>
....
And not:
myhost[10:10:10]/home/myuser> cd ..
myhost[10:10:10]/home> cd myuser
myhost[10:10:10]/home/myuser>
For suraj:
This is not an export problem I know that I've to export the PS1 varable.
Regards,
Bernardo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 09:52 PM
05-26-2005 09:52 PM
Re: PROBLEM WITH PROMPT AND HOUR
You only get "10:10:10" because PS1 in ONLY seted at login. There a function you may use for thids: the clock function (man clock)...
Regards,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2005 09:58 PM
05-26-2005 09:58 PM
Re: PROBLEM WITH PROMPT AND HOUR
$PWD will be update when directory is navigated. So that it will be replicated in prompt.
If you export it with date command, it will keep static data of time. I think there may be a change to have this in bash PS1.
check this out,
http://www.nersc.no/~knutal/unix_tips.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2005 12:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2005 12:17 AM
05-27-2005 12:17 AM
Re: PROBLEM WITH PROMPT AND HOUR
BINGO!!!
set +u works fine!
Thanks to all.
Bernardo