Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
scripting:posparams [2015/08/06 02:29]
bill_thomson
scripting:posparams [2018/05/12 18:04] (current)
wayeoyuz Typo
Line 37: Line 37:
 echo "​$0"​ echo "​$0"​
 </​code>​ </​code>​
-You see, ''​$0''​ is always set to the name the script is called with (''​$''​ is the prompt...):+You see, ''​$0''​ is always set to the name the script is called with (''​>''​ is the prompt...):
 <​code>​ <​code>​
 > ./​testscript ​ > ./​testscript ​
Line 259: Line 259:
  
 It's wise to signal "end of options"​ when setting positional It's wise to signal "end of options"​ when setting positional
-parameters this way. If not, the dashes might be interpreted as an option ​swich+parameters this way. If not, the dashes might be interpreted as an option ​switch
 by ''​set''​ itself: by ''​set''​ itself:
  
Line 266: Line 266:
 set -- ... set -- ...
 set - ... set - ...
 +</​code>​
 +
 +Alternately this will also preserve any verbose (-v) or tracing (-x) flags, which may otherwise be reset by ''​set''​
 +<​code>​
 +set -$- ...
 </​code>​ </​code>​
  
  • scripting/posparams.1438828190.txt
  • Last modified: 2015/08/06 02:29
  • by bill_thomson