<?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: Why my newcd got problem? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750447#M834722</link>
    <description>I got it, here is my new .kshrc,&lt;BR /&gt;set -o vi&lt;BR /&gt;set -o monitor&lt;BR /&gt;alias ll='ls -la'&lt;BR /&gt;alias setprmt='PS1=$HOST"["$USER"]:"${PWD##*/}" "'&lt;BR /&gt;setprmt&lt;BR /&gt;alias cd=newcd&lt;BR /&gt;function newcd&lt;BR /&gt;{&lt;BR /&gt;if test $# -ne 0&lt;BR /&gt;then&lt;BR /&gt;\cd "$@" &amp;gt;&amp;amp;- || return 1&lt;BR /&gt;setprmt&lt;BR /&gt;else&lt;BR /&gt;\cd&lt;BR /&gt;setprmt&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;echo "End of kshrc:"&lt;BR /&gt;  You see, now I understand why I must put \ before every cd and why we need to create such a newcd in ksh environment.&lt;BR /&gt;  Thank you very much for your help. I will assign points to you.&lt;BR /&gt;</description>
    <pubDate>Mon, 24 Jun 2002 23:29:04 GMT</pubDate>
    <dc:creator>zhaogui</dc:creator>
    <dc:date>2002-06-24T23:29:04Z</dc:date>
    <item>
      <title>Why my newcd got problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750439#M834714</link>
      <description>I found that I have to provide a parameter to "cd" command in order for my newcd to work properly. Can I do without this parameter? &lt;BR /&gt;&lt;BR /&gt;Here is my .kshrc&lt;BR /&gt;set -o vi&lt;BR /&gt;set -o monitor&lt;BR /&gt;alias ll='ls -la'&lt;BR /&gt;alias setprmt='PS1=$HOST"["$USER"]:"${PWD##*/}" "'&lt;BR /&gt;setprmt&lt;BR /&gt;alias cd=newcd&lt;BR /&gt;function newcd&lt;BR /&gt;{&lt;BR /&gt;    \cd "$@" &amp;gt;&amp;amp;- || return 1&lt;BR /&gt;    setprmt&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Can anybody tell me if the script for newcd is correct or not, why need \cd "$@" &amp;gt;&amp;amp;- and how to interpret it? Does it support null parameter?&lt;BR /&gt;Thanks,&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Jun 2002 02:24:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750439#M834714</guid>
      <dc:creator>zhaogui</dc:creator>
      <dc:date>2002-06-24T02:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why my newcd got problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750440#M834715</link>
      <description>As far as i can see, your cd is indeed just a bit different than normal:&lt;BR /&gt;&lt;BR /&gt;$@=$1$2$3...&lt;BR /&gt;($*=$1,$2,$3... where ,=IFS)&lt;BR /&gt;&amp;lt;&amp;amp;- = close standard output&lt;BR /&gt;&lt;BR /&gt;In other words, \cd is just the cd with all arguments concatenated. If it failes (||=OR) it returns 1, else it will continue with setting a nice-looking promt (setprmt=PS1-setting).&lt;BR /&gt;&lt;BR /&gt;if you do a 'cd a /b'&lt;BR /&gt;i suppose it will do a&lt;BR /&gt;cd a/b&lt;BR /&gt;, 'cause it should delete the spaces.&lt;BR /&gt;&lt;BR /&gt;If it was upto me, i would not set this newcd.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ceesjan&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Jun 2002 06:21:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750440#M834715</guid>
      <dc:creator>Ceesjan van Hattum</dc:creator>
      <dc:date>2002-06-24T06:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why my newcd got problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750441#M834716</link>
      <description>Here is the error message I got when I simply type 'cd' without any parameter,&lt;BR /&gt;myhost[myuser]:opc_op cd&lt;BR /&gt;newcd[2]: @: parameter not set&lt;BR /&gt;Normal cd will move to my home directory as what 'cd ~' does.  How come my newcd cannot?  &lt;BR /&gt;Other doubts:&lt;BR /&gt;1. why there is \ before cd? If I remove it,  I will get this,&lt;BR /&gt;myhost[myuser]:opc_op cd /usr&lt;BR /&gt;ksh: newcd: recursion too deep&lt;BR /&gt;2. what is close standard output for &amp;amp;-? Is it the same as normal standard output 1&amp;gt; ?&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Jun 2002 07:04:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750441#M834716</guid>
      <dc:creator>zhaogui</dc:creator>
      <dc:date>2002-06-24T07:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why my newcd got problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750442#M834717</link>
      <description>Another interesting doubt is, why the .kshrc always run after all commands in .profile finished?&lt;BR /&gt;&lt;BR /&gt;.kshrc is the same as mentioned above.&lt;BR /&gt;Here is .profile,&lt;BR /&gt;# Set up the shell variables:&lt;BR /&gt;        EDITOR=vi&lt;BR /&gt;        export EDITOR&lt;BR /&gt;&lt;BR /&gt;ENV='${START[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}'&lt;BR /&gt;START=$HOME/.kshrc&lt;BR /&gt;export ENV START&lt;BR /&gt;LANG=C                  ; export LANG&lt;BR /&gt;PWD=$HOME              ; export PWD&lt;BR /&gt;SHELL=/bin/ksh          ; export SHELL&lt;BR /&gt;HOST=`uname -n`       ; export HOST&lt;BR /&gt;USER=`logname`        ; export USER&lt;BR /&gt;echo $$&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Jun 2002 07:11:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750442#M834717</guid>
      <dc:creator>zhaogui</dc:creator>
      <dc:date>2002-06-24T07:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why my newcd got problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750443#M834718</link>
      <description>Hi Zhaogui,&lt;BR /&gt;&lt;BR /&gt;your .kshrc is run after the .profile because you have the entry:&lt;BR /&gt;&lt;BR /&gt;ENV=.........&lt;BR /&gt;&lt;BR /&gt;This variable tells your system, to source the .kshrc- file for each new kornshell which is started.&lt;BR /&gt;&lt;BR /&gt;and your newcd should work better, if you first run a test- command, to check if there are any parameters given to the function:&lt;BR /&gt;&lt;BR /&gt;if test $# -ne 0&lt;BR /&gt;then&lt;BR /&gt;     your_function_command&lt;BR /&gt;else&lt;BR /&gt;     cd&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Mon, 24 Jun 2002 07:18:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750443#M834718</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-24T07:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Why my newcd got problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750444#M834719</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;of course the whole construction has to look like this:&lt;BR /&gt;&lt;BR /&gt;function newcd&lt;BR /&gt;{&lt;BR /&gt;if test $# -ne 0&lt;BR /&gt;then&lt;BR /&gt;     \cd "$@" &amp;gt;&amp;amp;- || return 1&lt;BR /&gt;     setprmt&lt;BR /&gt;else&lt;BR /&gt;     cd&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter&lt;BR /&gt;   &lt;BR /&gt;</description>
      <pubDate>Mon, 24 Jun 2002 07:24:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750444#M834719</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-24T07:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why my newcd got problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750445#M834720</link>
      <description>Good progress! it can accept cd without any parameter, but still got another error message. here it is,&lt;BR /&gt;myhost[myuser]:opc_op cd /usr&lt;BR /&gt;myhost[myuser]:usr cd&lt;BR /&gt;ksh: newcd: recursion too deep&lt;BR /&gt;&lt;BR /&gt;I suspect this could be due to the endless loop of recursion, because cd calls newcd first and then call cd again, and call newcd again and again...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Jun 2002 07:37:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750445#M834720</guid>
      <dc:creator>zhaogui</dc:creator>
      <dc:date>2002-06-24T07:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why my newcd got problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750446#M834721</link>
      <description>Hi Zhaogui, &lt;BR /&gt;&lt;BR /&gt;what happens if you delete the "&amp;gt;&amp;amp;-"?&lt;BR /&gt;&lt;BR /&gt;And try to do the same script without "|| return 1".&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Mon, 24 Jun 2002 07:46:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750446#M834721</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-24T07:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why my newcd got problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750447#M834722</link>
      <description>I got it, here is my new .kshrc,&lt;BR /&gt;set -o vi&lt;BR /&gt;set -o monitor&lt;BR /&gt;alias ll='ls -la'&lt;BR /&gt;alias setprmt='PS1=$HOST"["$USER"]:"${PWD##*/}" "'&lt;BR /&gt;setprmt&lt;BR /&gt;alias cd=newcd&lt;BR /&gt;function newcd&lt;BR /&gt;{&lt;BR /&gt;if test $# -ne 0&lt;BR /&gt;then&lt;BR /&gt;\cd "$@" &amp;gt;&amp;amp;- || return 1&lt;BR /&gt;setprmt&lt;BR /&gt;else&lt;BR /&gt;\cd&lt;BR /&gt;setprmt&lt;BR /&gt;fi&lt;BR /&gt;}&lt;BR /&gt;echo "End of kshrc:"&lt;BR /&gt;  You see, now I understand why I must put \ before every cd and why we need to create such a newcd in ksh environment.&lt;BR /&gt;  Thank you very much for your help. I will assign points to you.&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Jun 2002 23:29:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-my-newcd-got-problem/m-p/2750447#M834722</guid>
      <dc:creator>zhaogui</dc:creator>
      <dc:date>2002-06-24T23:29:04Z</dc:date>
    </item>
  </channel>
</rss>

