<?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 Scripting Question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116764#M447083</link>
    <description>There is the catch. I do not want this shell script to be executed. I mean, it should resolve the variables inside w/o executing the shell script.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
    <pubDate>Mon, 30 Jun 2008 20:13:29 GMT</pubDate>
    <dc:creator>KapilRaj</dc:creator>
    <dc:date>2008-06-30T20:13:29Z</dc:date>
    <item>
      <title>Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116760#M447079</link>
      <description>After a long time, back to the ITRC. How are you guys doing ? ..&lt;BR /&gt;&lt;BR /&gt;Coming to the question ..&lt;BR /&gt;&lt;BR /&gt;I am looking for a command which will substitute the arguments given to a command.&lt;BR /&gt;&lt;BR /&gt;i.e.&lt;BR /&gt;If I execute that command this way,&lt;BR /&gt;&lt;BR /&gt;&lt;CMD&gt; &lt;COMMAND&gt; &lt;ARG1&gt; &lt;ARG2&gt; &lt;ARG3&gt; ....&lt;BR /&gt;&lt;BR /&gt;It should produce an output by replacing references to $1 as &lt;ARG1&gt;, $2 as &lt;ARG2&gt; and so on ...&lt;BR /&gt;&lt;BR /&gt;I can think of an "sed" solution. But I am looking for something smaller and simpler.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Kaps&lt;/ARG2&gt;&lt;/ARG1&gt;&lt;/ARG3&gt;&lt;/ARG2&gt;&lt;/ARG1&gt;&lt;/COMMAND&gt;&lt;/CMD&gt;</description>
      <pubDate>Mon, 30 Jun 2008 18:35:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116760#M447079</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2008-06-30T18:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116761#M447080</link>
      <description>That's a confusing request, as it doesn't sound like much of anything, so I think I'm misunderstanding.&lt;BR /&gt;&lt;BR /&gt;But "echo" will do that&lt;BR /&gt;&lt;BR /&gt;$&amp;gt; echo one two three four five six&lt;BR /&gt;one two three four five six&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 30 Jun 2008 19:07:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116761#M447080</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2008-06-30T19:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116762#M447081</link>
      <description>script1 is ,&lt;BR /&gt;&lt;BR /&gt;if [ $1 -eq 100 ]&lt;BR /&gt;then&lt;BR /&gt; echo "It was hundred "&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;And you execute&lt;BR /&gt;&lt;BR /&gt;&lt;COMMAND&gt; script1 10&lt;BR /&gt;&lt;BR /&gt;The output should be&lt;BR /&gt;&lt;BR /&gt;if [ 10 -eq 100 ]&lt;BR /&gt;then&lt;BR /&gt; echo "It was hundred "&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;I am looking for a script to replace "command"&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Kaps&lt;/COMMAND&gt;</description>
      <pubDate>Mon, 30 Jun 2008 19:51:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116762#M447081</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2008-06-30T19:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116763#M447082</link>
      <description>OK,  It looks to me you want to see what your commands would evaluate to while running.&lt;BR /&gt;&lt;BR /&gt;While it's not a script (its just a shell command option), this will get you close.&lt;BR /&gt;&lt;BR /&gt;$&amp;gt; set -x&lt;BR /&gt;&lt;BR /&gt;and then run your script.&lt;BR /&gt;&lt;BR /&gt;It will show you what you are looking for.&lt;BR /&gt;&lt;BR /&gt;An example to see if process id of the current shell is equal to 37.&lt;BR /&gt;&lt;BR /&gt;$&amp;gt; echo [ $$ -eq 37 ]|| echo yes &amp;amp;&amp;amp; echo no&lt;BR /&gt;+ echo '[' 7670 -eq 37 ']'&lt;BR /&gt;[ 7670 -eq 37 ]&lt;BR /&gt;+ echo no&lt;BR /&gt;no&lt;BR /&gt;&lt;BR /&gt;An easy way to do this is just to put a &lt;BR /&gt;"set -x" command near the top of your script, and comment it out when you don't need it any longer.</description>
      <pubDate>Mon, 30 Jun 2008 20:01:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116763#M447082</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2008-06-30T20:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116764#M447083</link>
      <description>There is the catch. I do not want this shell script to be executed. I mean, it should resolve the variables inside w/o executing the shell script.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Mon, 30 Jun 2008 20:13:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116764#M447083</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2008-06-30T20:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116765#M447084</link>
      <description>I am also going to believe that my question is really a stupid one. $1 , $2 kind of variables makes sense only when I execute it ..</description>
      <pubDate>Mon, 30 Jun 2008 20:18:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116765#M447084</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2008-06-30T20:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116766#M447085</link>
      <description>Hi Kaps:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I am also going to believe that my question is really a stupid one. $1 , $2 kind of variables makes sense only when I execute it ..&lt;BR /&gt;&lt;BR /&gt;From that perspective, make your script self-documenting:&lt;BR /&gt;&lt;BR /&gt;# cat somescript&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset WHO=$1&lt;BR /&gt;typeset WHERE=$2&lt;BR /&gt;echo "I said hello ${WHERE} ${WHO}"&lt;BR /&gt;&lt;BR /&gt;# ./somescript Kaps there&lt;BR /&gt;I said hello there Kaps&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 30 Jun 2008 20:30:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116766#M447085</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-06-30T20:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116767#M447086</link>
      <description>Thanks everybody.&lt;BR /&gt;&lt;BR /&gt;Hi JRF,&lt;BR /&gt;&lt;BR /&gt;In the example you gave, I was expecting an output like ,&lt;BR /&gt;&lt;BR /&gt;# cat somescript&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset WHO=kapil&lt;BR /&gt;typeset WHERE=&lt;BR /&gt;echo "I said hello ${WHERE} ${WHO}"&lt;BR /&gt;&lt;BR /&gt;I think it is an sed question i.e. ,&lt;BR /&gt;&lt;BR /&gt;cat myscript | sed "s;$1;arg1;g" .. .. , I think I have to do it that way.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Mon, 30 Jun 2008 20:52:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116767#M447086</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2008-06-30T20:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116768#M447087</link>
      <description>HI (again) Kaps:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I think it is an sed question i.e. ...cat myscript | sed "s;$1;arg1;g" .. .. , I think I have to do it that way&lt;BR /&gt;&lt;BR /&gt;Well, if that's what you really want, at least don't run the useless 'cat' process and fix the replacement:&lt;BR /&gt;&lt;BR /&gt;# sed 's;$1;arg1;g' file&lt;BR /&gt;&lt;BR /&gt;(or)&lt;BR /&gt;&lt;BR /&gt;# sed "s;\$1;arg1;g" file&lt;BR /&gt;&lt;BR /&gt;...but the use of a semicolon as a delimiter is limiting since you might want to make one pass and do:&lt;BR /&gt;&lt;BR /&gt;# sed "s/\$1/arg1/g;s/\$2/arg2/g" file&lt;BR /&gt;&lt;BR /&gt;(or):&lt;BR /&gt;&lt;BR /&gt;# sed 's/$1/arg1/g;s/$2/arg2/g' file&lt;BR /&gt;&lt;BR /&gt;Please note that I am still unsure as to what is your real objective.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 30 Jun 2008 21:20:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116768#M447087</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-06-30T21:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116769#M447088</link>
      <description>&amp;gt;I am looking for a command which will substitute the arguments given to a command.&lt;BR /&gt;&lt;BR /&gt;I'm still not sure what you want??&lt;BR /&gt;&lt;BR /&gt;&amp;gt;i.e. If I execute that command this way,&lt;BR /&gt;&lt;CMD&gt; &lt;COMMAND&gt; &lt;ARG1&gt; &lt;ARG2&gt; &lt;ARG3&gt; ....&lt;BR /&gt;&lt;BR /&gt;&amp;gt;It should produce an output by replacing references to $1 as &lt;ARG1&gt;, $2 as &lt;ARG2&gt; and so on&lt;BR /&gt;&lt;BR /&gt;If you want to change $1, etc, you can use set:&lt;BR /&gt;set &lt;ARG1&gt; &lt;ARG2&gt; &lt;ARG3&gt;&lt;/ARG3&gt;&lt;/ARG2&gt;&lt;/ARG1&gt;&lt;/ARG2&gt;&lt;/ARG1&gt;&lt;/ARG3&gt;&lt;/ARG2&gt;&lt;/ARG1&gt;&lt;/COMMAND&gt;&lt;/CMD&gt;</description>
      <pubDate>Tue, 01 Jul 2008 07:51:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116769#M447088</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-07-01T07:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116770#M447089</link>
      <description>I think I had too much beer that day. Today when I read my question, I can make neither head nor tail !&lt;BR /&gt;&lt;BR /&gt;Closing the thread ..</description>
      <pubDate>Tue, 31 Mar 2009 23:05:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-question/m-p/5116770#M447089</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2009-03-31T23:05:44Z</dc:date>
    </item>
  </channel>
</rss>

