[pacman-dev] bash argument passing help

Dan McGee dpmcgee at gmail.com
Tue Oct 20 23:34:16 EDT 2009


On Tue, Oct 20, 2009 at 10:30 PM, Allan McRae <allan at archlinux.org> wrote:
> Aaron Griffin wrote:
>>
>> On Tue, Oct 20, 2009 at 10:17 PM, Dan McGee <dpmcgee at gmail.com> wrote:
>>
>>>
>>> On Tue, Oct 20, 2009 at 9:45 PM, Allan McRae <allan at archlinux.org> wrote:
>>>> Note how in pass two, foo and bar are no longer in the one line.   Of
>>>> course, passing ./two.sh "$@" works, but the argument parsing in makepkg
>>>> clears that, hence the need to save it to ARGLIST.
>>
>> It's worth noting that the following works two:
>>
>> ./two.sh "$@"
>>
>> The reason being that "$@" is special in bash. It actually expands to
>> the command line quoted as you passed it, with "foo bar" being one
>> argument. The issue is with the assignment to a single bash variable
>>
>
> The reason that can not be used in makepkg is the option parsing uses
> "shift" and thus clears the value of $@ as it goes.

I thought I'd craft a witty reply but you beat me with a nicely worded
one. I happily trimmed the reply chain above to see the failure to
read. :P

-Dan


More information about the pacman-dev mailing list