<?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 Shell script's command line parameter delimiter in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180757#M162845</link>
    <description>Just wanted to get some ideas on how to pick up the delimiters from a command line in Korn shell script. &lt;BR /&gt;I will have delimiter ":" instead of space (which is default) in the command line for e.g:&lt;BR /&gt;# testmail &lt;SENDER&gt;:&lt;RECIEVER&gt;:&lt;SUBJECT&gt;:&lt;FILE attachment=""&gt;:&lt;NAME of="" attachment=""&gt;&lt;BR /&gt;/usr/sbin/sendmail -t &amp;lt;&amp;lt; EOM&lt;BR /&gt;From:$1&lt;BR /&gt;To:$2&lt;BR /&gt;Subject:$3&lt;BR /&gt;$(/usr/bin/uuencode $4 $5)&lt;BR /&gt;EOM&lt;BR /&gt;&lt;BR /&gt;In the above script,I want to pick up the delimiter ":" from the command line so as to pick up the positional parameter ($1,$2,$3..) values.&lt;BR /&gt;&lt;BR /&gt;Appreciate if you can give some ideas.&lt;BR /&gt;&lt;BR /&gt;Thanks much,&lt;BR /&gt;&lt;/NAME&gt;&lt;/FILE&gt;&lt;/SUBJECT&gt;&lt;/RECIEVER&gt;&lt;/SENDER&gt;</description>
    <pubDate>Mon, 02 Feb 2004 19:55:00 GMT</pubDate>
    <dc:creator>Victor Balenton</dc:creator>
    <dc:date>2004-02-02T19:55:00Z</dc:date>
    <item>
      <title>Shell script's command line parameter delimiter</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180757#M162845</link>
      <description>Just wanted to get some ideas on how to pick up the delimiters from a command line in Korn shell script. &lt;BR /&gt;I will have delimiter ":" instead of space (which is default) in the command line for e.g:&lt;BR /&gt;# testmail &lt;SENDER&gt;:&lt;RECIEVER&gt;:&lt;SUBJECT&gt;:&lt;FILE attachment=""&gt;:&lt;NAME of="" attachment=""&gt;&lt;BR /&gt;/usr/sbin/sendmail -t &amp;lt;&amp;lt; EOM&lt;BR /&gt;From:$1&lt;BR /&gt;To:$2&lt;BR /&gt;Subject:$3&lt;BR /&gt;$(/usr/bin/uuencode $4 $5)&lt;BR /&gt;EOM&lt;BR /&gt;&lt;BR /&gt;In the above script,I want to pick up the delimiter ":" from the command line so as to pick up the positional parameter ($1,$2,$3..) values.&lt;BR /&gt;&lt;BR /&gt;Appreciate if you can give some ideas.&lt;BR /&gt;&lt;BR /&gt;Thanks much,&lt;BR /&gt;&lt;/NAME&gt;&lt;/FILE&gt;&lt;/SUBJECT&gt;&lt;/RECIEVER&gt;&lt;/SENDER&gt;</description>
      <pubDate>Mon, 02 Feb 2004 19:55:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180757#M162845</guid>
      <dc:creator>Victor Balenton</dc:creator>
      <dc:date>2004-02-02T19:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script's command line parameter delimiter</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180758#M162846</link>
      <description>Something like this might work. I didn't get the opportunity to test it since I removed sendmail...&lt;BR /&gt;&lt;BR /&gt;STRING=$1&lt;BR /&gt;FROM=`echo $STRING | awk -F: '{print $1}'`&lt;BR /&gt;TO=`echo $STRING | awk -F: '{print $2}'`&lt;BR /&gt;SUBJECT=`echo $STRING | awk -F: '{print $3}'`&lt;BR /&gt;FILE_ATTACH=`echo $STRING | awk -F: '{print $4}'`&lt;BR /&gt;NAME_ATTACH=`echo $STRING | awk -F: '{print $5}'`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this would preceed the rest of your script.&lt;BR /&gt;and instead of having "From:$1", you would have&lt;BR /&gt;From:${FROM}&lt;BR /&gt;etc.&lt;BR /&gt;&lt;BR /&gt;It seemed to work when I used `echo $FROM`, etc.&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Feb 2004 20:17:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180758#M162846</guid>
      <dc:creator>Ian Kidd_1</dc:creator>
      <dc:date>2004-02-02T20:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script's command line parameter delimiter</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180759#M162847</link>
      <description>Note that the shell will still pay attention to spaces as parameter separators so you'll either have to require " around the string or escape the special meaning of spaces (in the subject line) with \ as in:&lt;BR /&gt; &lt;BR /&gt;testmail "myname@mydomain.com:somebody@another.com:This is a test:/etc/issue"&lt;BR /&gt; &lt;BR /&gt;testmail myname@mydomain.com:somebody@another.com:This\ is \a \test:/etc/issue&lt;BR /&gt; &lt;BR /&gt;Otherwise, there will be $2 $3 etc. Be sure to test for $# to make sure there's only 1 parameter.</description>
      <pubDate>Mon, 02 Feb 2004 20:48:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180759#M162847</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-02-02T20:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script's command line parameter delimiter</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180760#M162848</link>
      <description>I'm not sure this appropriate but I've developed a mail with attachment script. It take parameters 5 through whatever and uses them to put together the sujbect.&lt;BR /&gt;&lt;BR /&gt;It might be what you want. Probably not.&lt;BR /&gt;&lt;BR /&gt;I'm posting it anyway. Zero point me if its useless.&lt;BR /&gt;&lt;BR /&gt;You'll have to use awk as shown above to do it with colons and spaces will still screw that up.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 02 Feb 2004 21:04:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180760#M162848</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-02-02T21:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script's command line parameter delimiter</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180761#M162849</link>
      <description>you can try something like this&lt;BR /&gt;&lt;BR /&gt;oldIFS="$IFS"&lt;BR /&gt;IFS=":"&lt;BR /&gt;set -- $1&lt;BR /&gt;IFS="$oldIFS"</description>
      <pubDate>Mon, 02 Feb 2004 21:12:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180761#M162849</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-02-02T21:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script's command line parameter delimiter</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180762#M162850</link>
      <description>What you can do is:&lt;BR /&gt;(echo $1 | awk '{printf "From:%s\nTo:%s\nSubject:%s\n",$1,$2,$3}'&lt;BR /&gt;lf=$(echo $1 | cut -d: -f4)&lt;BR /&gt;af=$(echo $1 | cut -d: -f5)&lt;BR /&gt;/usr/bin/uuencode "$lf" "$af"&lt;BR /&gt;) | sendmail -t&lt;BR /&gt;&lt;BR /&gt;I would not recommend using awk for splitting the command line for each argument, as awk uses a lot of resources. The cut command is a lot smaller and does the trick quite right.&lt;BR /&gt;&lt;BR /&gt;Mind the quotes for the uuencode arguments, because you could have spaces in the local or attachment filenames, due to the colon argument seperation.</description>
      <pubDate>Tue, 03 Feb 2004 03:26:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180762#M162850</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-02-03T03:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script's command line parameter delimiter</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180763#M162851</link>
      <description>You could of course also use awk to split the arguments completely:&lt;BR /&gt;eval $(echo $1 | awk -F: '{printf "FROM='%s'\nTO='%s'\nSUBJECT='%s'\nLOCALFILE='%s'\nATTACHMENT='%s'\n",$1,$2,$3,$4,$5}')&lt;BR /&gt;&lt;BR /&gt;Then the rest is simple and straight forward, since you have 5 environment variables containing the seperate parts.</description>
      <pubDate>Tue, 03 Feb 2004 03:29:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180763#M162851</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-02-03T03:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script's command line parameter delimiter</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180764#M162852</link>
      <description>Thanks to all the ideas, appreciate it much, I picked up one of them which would help us better in our environment. I was planning to send this script's command parameters from an SAP application.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Victor</description>
      <pubDate>Tue, 03 Feb 2004 12:42:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-s-command-line-parameter-delimiter/m-p/3180764#M162852</guid>
      <dc:creator>Victor Balenton</dc:creator>
      <dc:date>2004-02-03T12:42:06Z</dc:date>
    </item>
  </channel>
</rss>

