[fpc-pascal] Parsing commandline parameters with wildcards on Linux

Sven Barth pascaldragon at googlemail.com
Sun Apr 10 11:42:11 CEST 2011


On 10.04.2011 01:34, Bart wrote:
> My program expects input from the commandline in the form
>
> scopy source dest
>
> when you now specify wildcards on the commandline, they will be
> expanded by bash, so the output will be like this:
>
[snip]
>
>
> However from inside my program I cannot distinguish between the
> followin 2 scenarios:
> 1: x is the last item in the list expanded by bash or
> 2: the commandline actually was "scopy * x"
>
> Scenario 1 is a syntax error, and it should not be treated as if it
> were scenario 2.
>
[snip]
>
>
> Obviously this is a common scenario on Linux, so how to treat it?
>

Just live with it... Normal "cp" works like that as well.

E.g.:

 > echo "Hello World 1" > test1
 > echo "Hello World 2" > test2
 > cp test*
 > cat test*
Hello World 1
Hello World 2

Regards,
Sven



More information about the fpc-pascal mailing list