<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: got time working in shell prompt, but date is not in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653926#M380521</link>
    <description>Steven, why do you think this is a bad idea?</description>
    <pubDate>Mon, 28 Jun 2010 18:36:56 GMT</pubDate>
    <dc:creator>digger86</dc:creator>
    <dc:date>2010-06-28T18:36:56Z</dc:date>
    <item>
      <title>got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653922#M380517</link>
      <description>I found on the forum how to get time to work in a shell prompt. &lt;BR /&gt;&lt;BR /&gt;#cat ~/.profile&lt;BR /&gt;&lt;BR /&gt;~sniped~&lt;BR /&gt;export DATE="$(date +'%D')"&lt;BR /&gt;export SECONDS="$(date '+3600*%H+60*%M+%S')"&lt;BR /&gt;typeset -Z2 _h; typeset -Z2 _m ; typeset -Z2 _s # 2 digits, zero padded&lt;BR /&gt;# hours, minutes and seconds...&lt;BR /&gt;_hh="(SECONDS/3600)%24"&lt;BR /&gt;_mm="(SECONDS/60)%60"&lt;BR /&gt;_ss="(SECONDS)%60"&lt;BR /&gt;_time='${_x[(_m=_mm)==(_h=_hh)==(_s=_ss)]}$_h:$_m:$_s'&lt;BR /&gt;~sniped~&lt;BR /&gt;&lt;BR /&gt;but the date does not change. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Jun 2010 17:51:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653922#M380517</guid>
      <dc:creator>digger86</dc:creator>
      <dc:date>2010-06-28T17:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653923#M380518</link>
      <description>I am confused.  What exactly are you trying to accomplish?  What's not working?  What does the output look like?</description>
      <pubDate>Mon, 28 Jun 2010 18:00:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653923#M380518</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2010-06-28T18:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653924#M380519</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;If you are trying to make the prompt include the date, which I think is a bad idea, set the values you want into the variable PS1&lt;BR /&gt;&lt;BR /&gt;Your snipped code area needs to include perhaps the date command.&lt;BR /&gt;&lt;BR /&gt;variable=$(date)&lt;BR /&gt;&lt;BR /&gt;Do some further processing in the parenthesis, to get the exact data you want.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 28 Jun 2010 18:07:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653924#M380519</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2010-06-28T18:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653925#M380520</link>
      <description>Patrick Thanks for trying to help&lt;BR /&gt;&lt;BR /&gt;# cat ~/.profile&lt;BR /&gt;# Custom varibles&lt;BR /&gt;EDITOR=vi&lt;BR /&gt;export EDITOR&lt;BR /&gt;stty erase ^?&lt;BR /&gt;export HISTFILE=$HOME/.sh_history&lt;BR /&gt;export HISTSIZE=5000&lt;BR /&gt;export HISTFILE HISTSIZE&lt;BR /&gt;alias ls="ls -aF"&lt;BR /&gt;export DATE="$(date +'%D')"&lt;BR /&gt;export SECONDS="$(date '+3600*%H+60*%M+%S')"&lt;BR /&gt;typeset -Z2 _h; typeset -Z2 _m ; typeset -Z2 _s # 2 digits, zero padded&lt;BR /&gt;# hours, minutes and seconds...&lt;BR /&gt;_hh="(SECONDS/3600)%24"&lt;BR /&gt;_mm="(SECONDS/60)%60"&lt;BR /&gt;_ss="(SECONDS)%60"&lt;BR /&gt;_time='${_x[(_m=_mm)==(_h=_hh)==(_s=_ss)]}$_h:$_m:$_s'&lt;BR /&gt;export PS1="^[[35m$(echo ${DATE} ${_time}) ^[[32m`whoami`@^[[31m`hostname`^[[36m&lt;BR /&gt; \$PWD ^[[0m$(echo "\n# ")"&lt;BR /&gt;&lt;BR /&gt;My prompt look like:&lt;BR /&gt;06/26/10 11:32:04 username@host /home/username&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;The date does not change but time does.&lt;BR /&gt;&lt;BR /&gt;Yes, this is very Linux like :)&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Jun 2010 18:35:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653925#M380520</guid>
      <dc:creator>digger86</dc:creator>
      <dc:date>2010-06-28T18:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653926#M380521</link>
      <description>Steven, why do you think this is a bad idea?</description>
      <pubDate>Mon, 28 Jun 2010 18:36:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653926#M380521</guid>
      <dc:creator>digger86</dc:creator>
      <dc:date>2010-06-28T18:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653927#M380522</link>
      <description>&amp;gt;why do you think this is a bad idea?&lt;BR /&gt;&lt;BR /&gt;Because the prompt should only be "$ " and nothing else.&lt;BR /&gt;It is the window title bar that should have the machine and directory path.&lt;BR /&gt;And you should have one clock on your desktop, not timestamps for each of your shells.</description>
      <pubDate>Tue, 29 Jun 2010 07:00:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653927#M380522</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-06-29T07:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653928#M380523</link>
      <description>&amp;gt;&amp;gt;Because the prompt should only be "$ "&lt;BR /&gt;&lt;BR /&gt;Say what?  Most things I agree with you, Dennis, but that is one of the most asinine statements I've ever read.&lt;BR /&gt;&lt;BR /&gt;If he wants the date and time on the prompt, more power to him.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;It is the window title bar that should have &lt;BR /&gt;&amp;gt;&amp;gt;the machine and directory path.&lt;BR /&gt;&lt;BR /&gt;Well, I can't say I agree there either.  &lt;BR /&gt;&lt;BR /&gt;Part of the beauty of Unix is you can make it do almost anything you want.  I personally prefer the server name and pwd to be in my PS1 prompt.  &lt;BR /&gt;&lt;BR /&gt;Everyone is entitled to their own opinion, I just happen to completely disagree with you in this case.</description>
      <pubDate>Tue, 29 Jun 2010 12:07:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653928#M380523</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2010-06-29T12:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653929#M380524</link>
      <description>&amp;gt;Patrick: I personally prefer the server name and pwd to be in my PS1 prompt.&lt;BR /&gt;&lt;BR /&gt;It depends on what you are doing.&lt;BR /&gt;If you absolutely positively need to know what machine you are on, I see your point.&lt;BR /&gt;&lt;BR /&gt;But I prefer a minimalist prompt so I can see my commands, especially when command editing.&lt;BR /&gt;I found that prompt fanciness gets in the way.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I just happen to completely disagree with you in this case.&lt;BR /&gt;&lt;BR /&gt;That's fine.  :-)</description>
      <pubDate>Tue, 29 Jun 2010 17:32:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653929#M380524</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-06-29T17:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653930#M380525</link>
      <description>Yes, I need to see the host name.  And I clearly separate between commands by making my prompt very colorful (Linux does this for that reason). Blue hostname means non-production host. Red means production.&lt;BR /&gt;&lt;BR /&gt;I am using escape sequences to add color to my prompt.  &lt;BR /&gt;&lt;BR /&gt;Having time it great to compare things such as Service Guard fail overs quickly.&lt;BR /&gt;&lt;BR /&gt;Date is great for taking snap shots of the terminal for later reference.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Jun 2010 17:43:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653930#M380525</guid>
      <dc:creator>digger86</dc:creator>
      <dc:date>2010-06-29T17:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653931#M380526</link>
      <description>Apart from the discussion about why you want this or not (for instance, if you DON'T have a graphical environment available, or are maintaining systems world-wide), you need to provide some extra info.&lt;BR /&gt;For instance, what shell are you trying to use?&lt;BR /&gt;ksh doesn't seem to do this, so are you using bash by any chance ?&lt;BR /&gt;And what version of bash?&lt;BR /&gt;&lt;BR /&gt;The reason it doesn't work, is because you have a very long set of lines to make the time work, but the date is pushed in a single variable and then used in the prompt. You should do something like you did with the time, to make it work.&lt;BR /&gt;Or when you use bash you don't have to do it so hard, just do:&lt;BR /&gt;PS1='$(date +"%D %H:%M:%S) \$PWD $ '&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Jun 2010 05:29:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653931#M380526</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2010-06-30T05:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653932#M380527</link>
      <description>Hi digger,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  hour, minutes, and seconds change in your prompt because the calculation is based on a "live" variable; your shell apparently supports the special variable SECONDS, which is constantly and automatically updated with the number of seconds that the shell has been alive.&lt;BR /&gt; In contrast, the DATE output is based on a variable which is set only once and not updated.&lt;BR /&gt;Perhaps DATE can be updated by forcing re-evaluation of its arguments, e.g.:&lt;BR /&gt; (eval echo $(date +'%D'))&lt;BR /&gt;but no guarantee :-)&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Wed, 30 Jun 2010 06:13:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653932#M380527</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2010-06-30T06:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: got time working in shell prompt, but date is not</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653933#M380528</link>
      <description>&amp;gt;Denis: But I prefer a minimalist prompt so I can see my commands, especially when command editing.&lt;BR /&gt;&lt;BR /&gt;Agree.</description>
      <pubDate>Wed, 30 Jun 2010 06:18:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/got-time-working-in-shell-prompt-but-date-is-not/m-p/4653933#M380528</guid>
      <dc:creator>Hakki Aydin Ucar</dc:creator>
      <dc:date>2010-06-30T06:18:23Z</dc:date>
    </item>
  </channel>
</rss>

