<?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 what is command line arguments.. ?? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319940#M712097</link>
    <description>Hi experts,&lt;BR /&gt;&lt;BR /&gt;  Could you tell me about comman line arugments while creating script. Then how set variable name like $0,$1,..$9,${10}..etc.&lt;BR /&gt;Atfer how to call this in program..&lt;BR /&gt;&lt;BR /&gt;Explain in details.&lt;BR /&gt;&lt;BR /&gt;Thanks In advance &lt;BR /&gt;&lt;BR /&gt;Shankar&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 30 Jun 2004 23:12:43 GMT</pubDate>
    <dc:creator>shan_7</dc:creator>
    <dc:date>2004-06-30T23:12:43Z</dc:date>
    <item>
      <title>what is command line arguments.. ??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319940#M712097</link>
      <description>Hi experts,&lt;BR /&gt;&lt;BR /&gt;  Could you tell me about comman line arugments while creating script. Then how set variable name like $0,$1,..$9,${10}..etc.&lt;BR /&gt;Atfer how to call this in program..&lt;BR /&gt;&lt;BR /&gt;Explain in details.&lt;BR /&gt;&lt;BR /&gt;Thanks In advance &lt;BR /&gt;&lt;BR /&gt;Shankar&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Jun 2004 23:12:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319940#M712097</guid>
      <dc:creator>shan_7</dc:creator>
      <dc:date>2004-06-30T23:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: what is command line arguments.. ??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319941#M712099</link>
      <description>You need not set them it is done by the shell itself..&lt;BR /&gt;&lt;BR /&gt;It is something like ..&lt;BR /&gt;&lt;BR /&gt;useradd kapil&lt;BR /&gt;&lt;BR /&gt;useradd command's $1 argument is "kapil" if u r to write a shell script for useradd i would write it as follows&lt;BR /&gt;&lt;BR /&gt;=================&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;username=$1 # Storing the first command line argument on to another variable called username&lt;BR /&gt;&lt;BR /&gt;/usr/bin/useradd $username&lt;BR /&gt;=================&lt;BR /&gt;&lt;BR /&gt;Regds,&lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Wed, 30 Jun 2004 23:16:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319941#M712099</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2004-06-30T23:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: what is command line arguments.. ??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319942#M712100</link>
      <description>write a script for ur self and learn it&lt;BR /&gt;&lt;BR /&gt;================&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo $0's first argument is $1&lt;BR /&gt;echo $0's second argument is $2&lt;BR /&gt;echo $0's third argument is $3&lt;BR /&gt;================&lt;BR /&gt;Save this script as script1.sh &lt;BR /&gt;&lt;BR /&gt;chmod 755 script.sh&lt;BR /&gt;./script.sh kapil you yourgf &lt;BR /&gt;&lt;BR /&gt;Now look at the output and you should be clear &lt;BR /&gt;&lt;BR /&gt;Kaps</description>
      <pubDate>Wed, 30 Jun 2004 23:21:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319942#M712100</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2004-06-30T23:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: what is command line arguments.. ??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319943#M712102</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Have a look at the ksh manpage:&lt;BR /&gt;      Positional parameters, parameters denoted by a number, can be assigned&lt;BR /&gt;      values with the set special command.  Parameter $0 is set from&lt;BR /&gt;      argument zero when the shell is invoked.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;as explained by Kapil you can run his script and see the output. This mechanism of parameter passing holds true even in case of functions called in the shell script.&lt;BR /&gt;&lt;BR /&gt;manish</description>
      <pubDate>Thu, 01 Jul 2004 00:27:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319943#M712102</guid>
      <dc:creator>Manish Srivastava</dc:creator>
      <dc:date>2004-07-01T00:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: what is command line arguments.. ??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319944#M712104</link>
      <description>An importrant detail: use double quotes to preserve spaces within arguments and variables (to prevent sh errors!).&lt;BR /&gt;&lt;BR /&gt;tst:&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# A=$1  will fail!!!&lt;BR /&gt;B="$1"&lt;BR /&gt;C="$2"&lt;BR /&gt;echo "First arg: $B"&lt;BR /&gt;echo "Second arg: $C"&lt;BR /&gt;&lt;BR /&gt;Example: tst "1 2 3" two&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Jul 2004 00:32:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319944#M712104</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-07-01T00:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: what is command line arguments.. ??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319945#M712106</link>
      <description>Hi shankar,&lt;BR /&gt;Simple way to analyse is create script as follows with name say "scr1" and let us assume you are passing 4 arguments to it:&lt;BR /&gt;&lt;BR /&gt;# vi scr1&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo $0&lt;BR /&gt;echo $1&lt;BR /&gt;echo $2&lt;BR /&gt;echo $3&lt;BR /&gt;echo $4&lt;BR /&gt;&lt;BR /&gt;:wq!&lt;BR /&gt;&lt;BR /&gt;# chmod +x scr1&lt;BR /&gt;# ./scr1 one two three four&lt;BR /&gt;&lt;BR /&gt;The output will be &lt;BR /&gt;scr1 one two three four&lt;BR /&gt;&lt;BR /&gt;Now $0 is the command itself i.e. scr1 and $1 is the first argument, $2 second and so on.&lt;BR /&gt;Hope that helps.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Jul 2004 01:59:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319945#M712106</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-07-01T01:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: what is command line arguments.. ??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319946#M712108</link>
      <description>hai,&lt;BR /&gt;&lt;BR /&gt; Command line arguments as like $1... ${N} can be used in the shell scripts,&lt;BR /&gt; as it is. By default $0 indicates in the shell script to denote it's filename, If we use the path name in the file execution as like&lt;BR /&gt; &lt;BR /&gt;  ksh /home/test/user.ksh 1 2 "hai bye test" "hello"&lt;BR /&gt;  &lt;BR /&gt;  $0 is the /home/test/user.ksh&lt;BR /&gt;  &lt;BR /&gt;  If we use the shell funtions,then $0 denotes the function name except test. If we use the funtion with test,it won't print the funtion name.&lt;BR /&gt;  &lt;BR /&gt;  $# is used to give the number of command line arguments in the shell script execution.&lt;BR /&gt;  $* is used to give the command line arguments as "$1 $2" like a string of all arguments&lt;BR /&gt;  $@ is used to give the command line arguments as "$1" $2" .. "$N" like a individual strings&lt;BR /&gt;  $! is used to get the running script's process ID&lt;BR /&gt;  $? is used to get the return value of last executed shell command&lt;BR /&gt;   &lt;BR /&gt;  See ksh man page for more details for command line arguments&lt;BR /&gt;  &lt;BR /&gt;Regards,&lt;BR /&gt;Muthukumar</description>
      <pubDate>Thu, 01 Jul 2004 02:02:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319946#M712108</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-01T02:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: what is command line arguments.. ??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319947#M712110</link>
      <description>Dear Shankar&lt;BR /&gt;&lt;BR /&gt;I suggest read page 50-52 of the follwing guide:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.docs.hp.com/hpux/pdf/B2355-90046.pdf" target="_blank"&gt;http://www.docs.hp.com/hpux/pdf/B2355-90046.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;sks</description>
      <pubDate>Thu, 01 Jul 2004 02:36:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/what-is-command-line-arguments/m-p/3319947#M712110</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-07-01T02:36:07Z</dc:date>
    </item>
  </channel>
</rss>

