<?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: difference between sh and ./ in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105451#M91182</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;If you run a script using sh , it means you did not mention the which shell the script will use. such as if you mention in the script  #!/usr/bin/ksh, you can execute the script using ./abc.sh way. Moreover if the file permissions will not 777 , but with ksh abc.sh will work&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;i login as root,and use sh abc.sh,it doesnot execute and returns no result.&lt;BR /&gt;&lt;BR /&gt;try to run like this&lt;BR /&gt;&lt;BR /&gt;#ksh abc.sh&lt;BR /&gt;&lt;BR /&gt;you are trying to execute the script using POSIX shell and you write the script using korn shell. you have mistaken buddy.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 25 Apr 2008 04:47:20 GMT</pubDate>
    <dc:creator>Jeeshan</dc:creator>
    <dc:date>2008-04-25T04:47:20Z</dc:date>
    <item>
      <title>difference between sh and ./</title>
      <link>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105448#M91179</link>
      <description>i have a script abc.sh(777 privilege) which written by ksh &lt;BR /&gt;&lt;BR /&gt;i  login as root,and use sh abc.sh,it  doesnot execute and returns no result.&lt;BR /&gt;&lt;BR /&gt;when i use ./abc.sh,it can be correctly executed .&lt;BR /&gt;&lt;BR /&gt;what is the difference between sh and ./, and why this happen</description>
      <pubDate>Fri, 25 Apr 2008 03:29:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105448#M91179</guid>
      <dc:creator>leelangco_1</dc:creator>
      <dc:date>2008-04-25T03:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: difference between sh and ./</title>
      <link>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105449#M91180</link>
      <description>If you use abc.sh or "sh abc.sh", it's going to want to look it up in your $PATH.  If you use ./abc.sh, it knows exactly where to find it.&lt;BR /&gt;&lt;BR /&gt;Typically root doesn't put "." in its $PATH as a security precaution.</description>
      <pubDate>Fri, 25 Apr 2008 03:39:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105449#M91180</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-25T03:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: difference between sh and ./</title>
      <link>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105450#M91181</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;As Dennis mentioned it above, it is a PATH issue.&lt;BR /&gt;&lt;BR /&gt;You can run a script by specifying either of the following:&lt;BR /&gt;1. Relative path&lt;BR /&gt; e.g.&lt;BR /&gt;    ./abc.sh&lt;BR /&gt;&lt;BR /&gt;2. Full path&lt;BR /&gt; e,g,&lt;BR /&gt;    /home/yogeeraj/abc.sh&lt;BR /&gt;&lt;BR /&gt;3. Specify the location of the script in the PATH environment variable.&lt;BR /&gt;   e.g.&lt;BR /&gt;    export PATH=$PATH:/home/yogeeraj/&lt;BR /&gt;   or&lt;BR /&gt;    export PATH=$PATH:.&lt;BR /&gt;&lt;BR /&gt;  then you can just:&lt;BR /&gt;   abc.sh&lt;BR /&gt;&lt;BR /&gt;Also, as mentioned root have "." in its $PATH as a security precaution.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hope it is now clear.&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Fri, 25 Apr 2008 04:07:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105450#M91181</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-04-25T04:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: difference between sh and ./</title>
      <link>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105451#M91182</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;If you run a script using sh , it means you did not mention the which shell the script will use. such as if you mention in the script  #!/usr/bin/ksh, you can execute the script using ./abc.sh way. Moreover if the file permissions will not 777 , but with ksh abc.sh will work&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;i login as root,and use sh abc.sh,it doesnot execute and returns no result.&lt;BR /&gt;&lt;BR /&gt;try to run like this&lt;BR /&gt;&lt;BR /&gt;#ksh abc.sh&lt;BR /&gt;&lt;BR /&gt;you are trying to execute the script using POSIX shell and you write the script using korn shell. you have mistaken buddy.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Apr 2008 04:47:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105451#M91182</guid>
      <dc:creator>Jeeshan</dc:creator>
      <dc:date>2008-04-25T04:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: difference between sh and ./</title>
      <link>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105452#M91183</link>
      <description>&amp;gt;ahsan: you are trying to execute the script using POSIX shell and you write the script using korn shell. you have mistaken buddy.&lt;BR /&gt;&lt;BR /&gt;Since they are pretty similar, it still may work.</description>
      <pubDate>Fri, 25 Apr 2008 09:42:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105452#M91183</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-25T09:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: difference between sh and ./</title>
      <link>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105453#M91184</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;As noted, on a properly configured system, root's '.profile' does not specify a dot ('.') in the PATH variable it exports to its environment.  This means that to specify a search within your current directory, *you* may need to type "./" in front of a file name.&lt;BR /&gt;&lt;BR /&gt;To add a dot to root's PATH is a security risk.&lt;BR /&gt;&lt;BR /&gt;By the way, setting 777 (rwx) permissions on your scripts is very poor security too!  There is NO need for your group, and certainly not the world's community, to be able to *write* to your script!  A setting of 755 is as far as you should go.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 25 Apr 2008 12:54:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105453#M91184</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-04-25T12:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: difference between sh and ./</title>
      <link>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105454#M91185</link>
      <description>thank you all</description>
      <pubDate>Sat, 26 Apr 2008 00:48:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/difference-between-sh-and/m-p/5105454#M91185</guid>
      <dc:creator>leelangco_1</dc:creator>
      <dc:date>2008-04-26T00:48:43Z</dc:date>
    </item>
  </channel>
</rss>

