<?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: differnece between &amp;quot;cd&amp;quot; and &amp;quot;/usr/bin/cd&amp;quot; in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196361#M792302</link>
    <description>Check the man-page from the shell?!&lt;BR /&gt;&lt;BR /&gt;JP.</description>
    <pubDate>Mon, 23 Feb 2004 02:38:23 GMT</pubDate>
    <dc:creator>Jeroen Peereboom</dc:creator>
    <dc:date>2004-02-23T02:38:23Z</dc:date>
    <item>
      <title>differnece between "cd" and "/usr/bin/cd"</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196355#M792296</link>
      <description>I'm writing postscript for Ignite and uses the full path for system command, here is my issue:&lt;BR /&gt;&lt;BR /&gt;if I type :&lt;BR /&gt;cd /var/tmp ; pwd &lt;BR /&gt;The answer is : /var/tmp&lt;BR /&gt;&lt;BR /&gt;If I type :&lt;BR /&gt;/usr/bin/cd /var/tmp ; pwd&lt;BR /&gt;The answer is : /tmp  ( which was my previous working dir)&lt;BR /&gt;&lt;BR /&gt;which cd  &amp;gt;&amp;gt; /usr/bin/cd  &lt;BR /&gt;&lt;BR /&gt;How do you explaine this ?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Feb 2004 04:03:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196355#M792296</guid>
      <dc:creator>MEYER_8</dc:creator>
      <dc:date>2004-02-19T04:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: differnece between "cd" and "/usr/bin/cd"</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196356#M792297</link>
      <description>"cd" is a shell internal, i.e the shell handles the changing of the directory itself.  the default action of the shell internal version od "cd" is to say where you are, logically.  In other words if you "cd " to a symbolic link, "cd" will report the symbolic link name, not the actual directory.  You can change this by going "cd -P".&lt;BR /&gt; &lt;BR /&gt;"/usr/bin/cd" is a binary that changes your working directory.  It's default behavior is to show you the real directory you are in.&lt;BR /&gt; &lt;BR /&gt;My guess is that you have /var/tmp symbolically linked to /tmp</description>
      <pubDate>Thu, 19 Feb 2004 04:09:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196356#M792297</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-02-19T04:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: differnece between "cd" and "/usr/bin/cd"</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196357#M792298</link>
      <description>Since the shell runs commands in a sub process,  running /usr/bin/cd changes the current directory of the subprocess, but not of the main process (the shell process). Therefore use "cd" (the shell built-in) rather than /usr/bin/cd.&lt;BR /&gt;&lt;BR /&gt;It's hard think of any use for /usr/bin/cd, but try "man cd" if you're interested - on 11i, it gives an example of the use of "cd" in a find command which might equate to /usr/bin/cd.</description>
      <pubDate>Thu, 19 Feb 2004 04:20:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196357#M792298</guid>
      <dc:creator>Alan Turner</dc:creator>
      <dc:date>2004-02-19T04:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: differnece between "cd" and "/usr/bin/cd"</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196358#M792299</link>
      <description>actually, Alan's answer makes much more sense :)</description>
      <pubDate>Thu, 19 Feb 2004 04:25:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196358#M792299</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-02-19T04:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: differnece between "cd" and "/usr/bin/cd"</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196359#M792300</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;as said "cd" is internal to the shell and therefor does not deliver an exit code.&lt;BR /&gt;&lt;BR /&gt;In case you create a script and want to validate, if a "cd target_dir" will succeed, you can use the binary in an if-statement and you will have existence and permission-check all in one.&lt;BR /&gt;&lt;BR /&gt;Bad script:&lt;BR /&gt;cd /tmp/mydir&lt;BR /&gt;rm *&lt;BR /&gt;&lt;BR /&gt;Now just assume /tmp/mydir is not accessible for whatever reason...... Directory where you have been before will be destroyed.&lt;BR /&gt;&lt;BR /&gt;Better script:&lt;BR /&gt;if /usr/bin/cd /tmp/mydir&lt;BR /&gt;then&lt;BR /&gt;  do what you like here&lt;BR /&gt;else&lt;BR /&gt;  do what you not like here&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have to say I never really used that, but I remember a school-lesson that said it should be used that way.&lt;BR /&gt;&lt;BR /&gt;May be you can let us know if you tried it out ?&lt;BR /&gt;Volker</description>
      <pubDate>Thu, 19 Feb 2004 15:48:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196359#M792300</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2004-02-19T15:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: differnece between "cd" and "/usr/bin/cd"</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196360#M792301</link>
      <description>I'm satisfy with the answers. &lt;BR /&gt;Using cd in my scripts works.&lt;BR /&gt;&lt;BR /&gt;Is there a list of the internal commands ?</description>
      <pubDate>Mon, 23 Feb 2004 02:33:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196360#M792301</guid>
      <dc:creator>MEYER_8</dc:creator>
      <dc:date>2004-02-23T02:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: differnece between "cd" and "/usr/bin/cd"</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196361#M792302</link>
      <description>Check the man-page from the shell?!&lt;BR /&gt;&lt;BR /&gt;JP.</description>
      <pubDate>Mon, 23 Feb 2004 02:38:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196361#M792302</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-02-23T02:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: differnece between "cd" and "/usr/bin/cd"</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196362#M792303</link>
      <description>Hi Volker&lt;BR /&gt;You typed:&lt;BR /&gt;&lt;BR /&gt;'as said "cd" is internal to the shell and therefor does not deliver an exit code.'&lt;BR /&gt;&lt;BR /&gt;That is false.&lt;BR /&gt;&lt;BR /&gt;Supose /kkad doesn't exist:&lt;BR /&gt;&lt;BR /&gt;# cd /kafd; echo "return code is $?"&lt;BR /&gt;/usr/bin/sh: /kafd:  not found&lt;BR /&gt;return code is 1&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Feb 2004 03:19:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196362#M792303</guid>
      <dc:creator>Jdamian</dc:creator>
      <dc:date>2004-02-23T03:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: differnece between "cd" and "/usr/bin/cd"</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196363#M792304</link>
      <description>Hi J. Damian,&lt;BR /&gt;&lt;BR /&gt;thank you for showing this.&lt;BR /&gt;In fact I took this from "man cd"&lt;BR /&gt;:&lt;BR /&gt;Another usage of cd as a stand-alone command is to obtain the exit status of the command.&lt;BR /&gt;:&lt;BR /&gt;And assumed (wrongly) that the internal one does not deliver an exit code.&lt;BR /&gt;May be this manpage-info is outdated and it was so in earlier days.&lt;BR /&gt;&lt;BR /&gt;So the only difference is, that the executable creates a real new subprocess, thus making this processing diffrent:&lt;BR /&gt;&lt;BR /&gt;# cd /&lt;BR /&gt;# if cd /tmp; then echo I could [and did] change to /tmp; else echo Did not work; fi&lt;BR /&gt;I could [and did] change to /tmp&lt;BR /&gt;# pwd&lt;BR /&gt;/tmp&lt;BR /&gt;&lt;BR /&gt;# cd /&lt;BR /&gt;# if /usr/bin/cd /tmp; then echo I could [and did not] change to /tmp; else echo Did not work; fi&lt;BR /&gt;I could [and did not] change to /tmp&lt;BR /&gt;# pwd&lt;BR /&gt;/&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;Confusing :-)&lt;BR /&gt;Volker</description>
      <pubDate>Mon, 23 Feb 2004 12:30:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/differnece-between-quot-cd-quot-and-quot-usr-bin-cd-quot/m-p/3196363#M792304</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2004-02-23T12:30:13Z</dc:date>
    </item>
  </channel>
</rss>

