<?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: unset positional parameter in shell in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/unset-positional-parameter-in-shell/m-p/5345151#M639437</link>
    <description>&lt;P&gt;Your while-loop proposal can be simplified to:&lt;/P&gt;&lt;PRE&gt;shift $#&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you use the "set" command to set positional parameters, you should use "set -- &amp;lt;positional parameters&amp;gt;" to make sure you don't accidentally change any shell options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An alternative way to unset all positional parameters would be:&lt;/P&gt;&lt;PRE&gt;set --&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Sep 2011 09:22:43 GMT</pubDate>
    <dc:creator>Matti_Kurkela</dc:creator>
    <dc:date>2011-09-27T09:22:43Z</dc:date>
    <item>
      <title>unset positional parameter in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unset-positional-parameter-in-shell/m-p/5345083#M639436</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can i unset positional parameter﻿ ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unset a defined variable using the unset command:&lt;BR /&gt;unset variable_name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unset positional parameter﻿ ?﻿&lt;/P&gt;&lt;P&gt;my proposal﻿ ? :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while [ $# -gt 0 ]&lt;BR /&gt;do&lt;BR /&gt;&amp;nbsp; shift&lt;BR /&gt;done&lt;BR /&gt;﻿&lt;BR /&gt;test:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set a b c&lt;BR /&gt;$ echo "$*"&lt;BR /&gt;abc&lt;/P&gt;&lt;P&gt;#positional parameters $1, $2,$3&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;while [ $# -gt 0 ]&lt;BR /&gt;do&lt;BR /&gt;&amp;nbsp; shift&lt;BR /&gt;done﻿﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;echo "$*"﻿&lt;/P&gt;&lt;P&gt;$&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2011 08:46:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unset-positional-parameter-in-shell/m-p/5345083#M639436</guid>
      <dc:creator>support_billa</dc:creator>
      <dc:date>2011-09-27T08:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: unset positional parameter in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unset-positional-parameter-in-shell/m-p/5345151#M639437</link>
      <description>&lt;P&gt;Your while-loop proposal can be simplified to:&lt;/P&gt;&lt;PRE&gt;shift $#&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you use the "set" command to set positional parameters, you should use "set -- &amp;lt;positional parameters&amp;gt;" to make sure you don't accidentally change any shell options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An alternative way to unset all positional parameters would be:&lt;/P&gt;&lt;PRE&gt;set --&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2011 09:22:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unset-positional-parameter-in-shell/m-p/5345151#M639437</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2011-09-27T09:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: unset positional parameter in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unset-positional-parameter-in-shell/m-p/5345927#M639438</link>
      <description>&lt;P&gt;Typically you just use shift to march through your parms.&amp;nbsp; You can use "set -A" to copy the parms to an array and then you can fiddle with that array.&amp;nbsp; (Provided there are only 1023 parms.)&lt;/P&gt;&lt;P&gt;And then another "set -A" to restore the changed parms.&lt;/P&gt;&lt;P&gt;set -A SAVEARGS -- "$@"&lt;BR /&gt;&lt;BR /&gt;The proper way to reset them is:&lt;BR /&gt;set -- "${SAVEARGS[@]}"﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://h30499.www3.hp.com/t5/Languages-and-Scripting/Shift-command/m-p/4133193" target="_blank"&gt;http://h30499.www3.hp.com/t5/Languages-and-Scripting/Shift-command/m-p/4133193&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2011 20:43:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unset-positional-parameter-in-shell/m-p/5345927#M639438</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-27T20:43:19Z</dc:date>
    </item>
  </channel>
</rss>

