[pacman-dev] [PATCH 1/2] makepkg: clean up test usage

Allan McRae allan at archlinux.org
Sun Jan 18 01:11:06 EST 2009

Allan McRae wrote:
> Dan McGee wrote:
>> In a lot of places, we had the following construct:
>>   [ "$foobar" = "0" ]
>> which is better represented by using the integer tests:
>>   [ $foobar -eq 0 ]
>> Attempt to unify makepkg to use the latter rather than the former in all
>> places. From here on out we should ensure anything that is set to 0, 
>> 1, etc.
>> uses the -eq format rather than =.
>> In addition, fix a few other test anomalies including usage of double
>> equals.
> In the Advanced Bash-Scripting Guide (http://tldp.org/LDP/abs/html/), 
> they still use quotes around the variables with -eq.  Both seem to 
> work, so I wonder why?
> Otherwise, I have no problems with either of  these tidy-up patches.

Looking into this further, it seems that the ABS guide always quotes 
variables.  I.e. [ "$foobar" -eq 0 ].  Exceptions being $? and $#.  I 
have tried to figure out what advantage this gives but can not find any.


More information about the pacman-dev mailing list