<?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: echo command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008708#M751102</link>
    <description>Thanks ..&lt;BR /&gt;&lt;BR /&gt;But the problem is i cannot control the user input .. &lt;BR /&gt;&lt;BR /&gt;So we might have user doing ./test.sh `rm -rf *` and it will damage the system.&lt;BR /&gt;&lt;BR /&gt;We are trying to play around with the script whether we can avoid this.&lt;BR /&gt;&lt;BR /&gt;Any idea how ?</description>
    <pubDate>Tue, 29 May 2007 01:23:39 GMT</pubDate>
    <dc:creator>malay boy</dc:creator>
    <dc:date>2007-05-29T01:23:39Z</dc:date>
    <item>
      <title>echo command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008706#M751098</link>
      <description>Hi ,&lt;BR /&gt;  I have this script test.sh as below:&lt;BR /&gt;&lt;BR /&gt;for x in "${*}"&lt;BR /&gt;do&lt;BR /&gt;echo $x &amp;gt; /tmp/rub.log&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;But the problem is is if I do below :&lt;BR /&gt;&lt;BR /&gt;./test.sh `pwd`&lt;BR /&gt;&lt;BR /&gt;when I do :&lt;BR /&gt;&lt;BR /&gt;#more /tmp/rub.log&lt;BR /&gt;/tmp &lt;BR /&gt;&lt;BR /&gt;What i intend to do is so that even if I put in &lt;BR /&gt;&lt;BR /&gt;#./test.sh `pwd`&lt;BR /&gt;#more /tmp/rub.log&lt;BR /&gt;`pwd`&lt;BR /&gt;&lt;BR /&gt;any help please&lt;BR /&gt;&lt;BR /&gt;Regards &lt;BR /&gt;mB</description>
      <pubDate>Tue, 29 May 2007 00:30:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008706#M751098</guid>
      <dc:creator>malay boy</dc:creator>
      <dc:date>2007-05-29T00:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: echo command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008707#M751100</link>
      <description>&lt;!--!*#--&gt;The shell expands:&lt;BR /&gt;    `pwd`&lt;BR /&gt;into:&lt;BR /&gt;    /tmp&lt;BR /&gt;(or whatever it is), so your script sees&lt;BR /&gt;only:&lt;BR /&gt;    /tmp&lt;BR /&gt;(or whatever), not:&lt;BR /&gt;    `pwd`&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;You could use apostrophes to quote the thing:&lt;BR /&gt;    ./test.sh '`pwd`'</description>
      <pubDate>Tue, 29 May 2007 01:05:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008707#M751100</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-05-29T01:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: echo command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008708#M751102</link>
      <description>Thanks ..&lt;BR /&gt;&lt;BR /&gt;But the problem is i cannot control the user input .. &lt;BR /&gt;&lt;BR /&gt;So we might have user doing ./test.sh `rm -rf *` and it will damage the system.&lt;BR /&gt;&lt;BR /&gt;We are trying to play around with the script whether we can avoid this.&lt;BR /&gt;&lt;BR /&gt;Any idea how ?</description>
      <pubDate>Tue, 29 May 2007 01:23:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008708#M751102</guid>
      <dc:creator>malay boy</dc:creator>
      <dc:date>2007-05-29T01:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: echo command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008709#M751104</link>
      <description>Hi.&lt;BR /&gt;&lt;BR /&gt;The other way would be to Escape the special characters instead of putting them in quotes.&lt;BR /&gt;&lt;BR /&gt;So it would read &lt;BR /&gt;&lt;BR /&gt;#./test.sh \`pwd\`&lt;BR /&gt;&lt;BR /&gt;The problem with quoting is that shells evaluate single quotes(') and double quotes (") differently and this can be confusing especially to shell script novices.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Andrew Y</description>
      <pubDate>Tue, 29 May 2007 01:25:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008709#M751104</guid>
      <dc:creator>Andrew Young_2</dc:creator>
      <dc:date>2007-05-29T01:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: echo command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008710#M751106</link>
      <description>&lt;!--!*#--&gt;&amp;gt; So we might have user doing ./test.sh&lt;BR /&gt;&amp;gt; `rm -rf *` and it will damage the system.&lt;BR /&gt;&lt;BR /&gt;If the user can damage the system that way,&lt;BR /&gt;then why couldn't he do it more easily by&lt;BR /&gt;just saying:&lt;BR /&gt;    rm -rf *&lt;BR /&gt;?&lt;BR /&gt;Why would he need your script to cause&lt;BR /&gt;trouble?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; We are trying to play around with the&lt;BR /&gt;&amp;gt; script whether we can avoid this.&lt;BR /&gt;&lt;BR /&gt;Good luck.  As I said, your script never&lt;BR /&gt;sees:&lt;BR /&gt;    `pwd`&lt;BR /&gt;or:&lt;BR /&gt;    `rm -rf *`&lt;BR /&gt;The shell evaluates those expressions before&lt;BR /&gt;it passes the output to your script.&lt;BR /&gt;</description>
      <pubDate>Tue, 29 May 2007 01:40:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008710#M751106</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-05-29T01:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: echo command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008711#M751108</link>
      <description>It is silly to do this: "${*}"&lt;BR /&gt;It is the same as ${*}.  If you want each quoted you must use: "${@}"</description>
      <pubDate>Tue, 29 May 2007 02:35:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008711#M751108</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-05-29T02:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: echo command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008712#M751110</link>
      <description>It sounds like you really want to write your own shell so you can parse the commands yourself and decide what is or isn't appropriate to execute.&lt;BR /&gt;&lt;BR /&gt;There is the restricted shell (rsh) that prevents certain kinds of command execution.</description>
      <pubDate>Wed, 30 May 2007 07:47:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008712#M751110</guid>
      <dc:creator>Tony Abo</dc:creator>
      <dc:date>2007-05-30T07:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: echo command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008713#M751112</link>
      <description>&lt;!--!*#--&gt;I think the other Tony is closest... sounds like mB wants to create a chroot'd jailed shell for users. HP-UX Restricted shell might be the easiest, unless he wants his users to have very limited abilities, then he should probably just write a 'case' statement script:&lt;BR /&gt;&lt;BR /&gt;case ${RSH_CMD} in&lt;BR /&gt;        rm)&lt;BR /&gt;           echo "No way, Jose."&lt;BR /&gt;           ;;&lt;BR /&gt;        ls)&lt;BR /&gt;           /usr/bin/ls&lt;BR /&gt;           ;;&lt;BR /&gt;        mv)&lt;BR /&gt;           if [ "${USERNAME}" = "Tony" ]; then&lt;BR /&gt;             /usr/bin/mv&lt;BR /&gt;           else&lt;BR /&gt;             echo "No way, Jose."&lt;BR /&gt;           fi&lt;BR /&gt;           ;;&lt;BR /&gt;        *)&lt;BR /&gt;           echo "Not a supported command."&lt;BR /&gt;           ;;&lt;BR /&gt;  esac&lt;BR /&gt;&lt;BR /&gt;Anyway, you get the idea.</description>
      <pubDate>Fri, 01 Jun 2007 16:00:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/echo-command/m-p/4008713#M751112</guid>
      <dc:creator>Tony Berry</dc:creator>
      <dc:date>2007-06-01T16:00:32Z</dc:date>
    </item>
  </channel>
</rss>

