Command-line arguments: Difference between revisions

(Add applescript)
Line 1,183:
[ dup . char: = emit space ] is #=
1 #args [ i #= show-arg ] countedLoop</lang>
 
=={{header|TXR}}==
 
Command line arguments in TXR can be treated as the lines of a text stream, which is arranged using the directive <code>@(next :args)</code>. Thus TXR's text parsing capabilities work over the argument list.
 
This <code>@(next :args)</code> should be written as the first line of the TXR program, because TXR otherwise interprets the first argument as the name of an input file to open.
 
<lang txr>@(next :args)
@(collect)
@arg
@(end)
@(output)
My args are: {@(rep)@arg, @(last)@arg@(end)}
@(end)</lang>
 
<pre>$ ./txr args.txr
My args are: {}
$ ./txr args.txr 1
My args are: {1}
$ ./txr args.txr 1 2 3
My args are: {1, 2, 3}</pre>
 
 
=={{header|UNIX Shell}}==
Anonymous user