<?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: shell script-- $PATH lookup in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-need-help/m-p/5507217#M640152</link>
    <description>&lt;P&gt;&amp;gt;./ seems do magic in many occasions. What is behind this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is elementary shells 101.&lt;/P&gt;&lt;P&gt;As Duncan said, for all commands that are not relative, absolute or builtin, it looks them up in $PATH.&lt;/P&gt;&lt;P&gt;Adding "./" makes the command have a relative path.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2012 21:55:17 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2012-01-24T21:55:17Z</dc:date>
    <item>
      <title>shell script--Need Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-need-help/m-p/5506833#M640150</link>
      <description>&lt;P&gt;./ seems do magic in many occasions. What is behind this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;./test.ksh works, but test.ksh give test.ksh not found.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2012 15:18:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-need-help/m-p/5506833#M640150</guid>
      <dc:creator>HP-UX-OS</dc:creator>
      <dc:date>2012-01-24T15:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: shell script--Need Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-need-help/m-p/5506847#M640151</link>
      <description>&lt;P&gt;This is down to the PATH environment variable - i.e. the directories that the shell will look in to run a command. You can see what it is currently set to using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;echo $PATH&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So anything in those directories will be searched to run the command you type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm assuming you are attempting the command you specify as root? For root it is not a good idea to have the current directory on the PATH as it makes it easy for folks to inject trojans into the system by leaving scripts that attack a system in directories with names similar to standard commands. Of course when you are root you get round this by explicitly referencing the current directory by adding ./ to the start of the command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you look at standard .profiles for non-root users you will see that often the current directory is added to the PATH as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;PATH=$PATH:.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it is NOT a good idea to make this change for root.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 07:10:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-need-help/m-p/5506847#M640151</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2021-06-29T07:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: shell script-- $PATH lookup</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-need-help/m-p/5507217#M640152</link>
      <description>&lt;P&gt;&amp;gt;./ seems do magic in many occasions. What is behind this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is elementary shells 101.&lt;/P&gt;&lt;P&gt;As Duncan said, for all commands that are not relative, absolute or builtin, it looks them up in $PATH.&lt;/P&gt;&lt;P&gt;Adding "./" makes the command have a relative path.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2012 21:55:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-need-help/m-p/5507217#M640152</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2012-01-24T21:55:17Z</dc:date>
    </item>
  </channel>
</rss>

