[pacman-dev] [PATCH 1/2] Changing [ to [[ and ((

Allan McRae allan at archlinux.org
Thu Nov 12 18:07:04 EST 2009


Cedric Staniewski wrote:
> Isaac Good wrote:
>>> >From f40b051c1c649889a13f35965fa8f8decd505b47 Mon Sep 17 00:00:00 2001
>> From: Isaac Good <pacman at isaac.otherinbox.com>
>> Date: Wed, 11 Nov 2009 16:47:43 -0500
>> Subject: [PATCH 1/2] Changing [ to [[ and ((
>>
>> First half of makepkg
>> This replaces any prior patches of mine
>> Includes stuff like -o to || and -a to && etc
>> if [ $(type ..  were preserved due to a bash bug with [[ and set -e and ERR traps
>>
>> Signed-off-by: Isaac Good <pacman at isaac.otherinbox.com>
>> ---
> 
> I hope your patch do not get lost in this thread.

I have the patches marked so that they will not be lost.


>> @@ -450,12 +450,12 @@ download_sources() {
>>  	for netfile in "${source[@]}"; do
>>  		local file=$(get_filename "$netfile")
>>  		local url=$(get_url "$netfile")
>> -		if [ -f "$startdir/$file" ]; then
>> +		if [[ -f "$startdir/$file" ]]; then
>>  			msg2 "$(gettext "Found %s in build dir")" "$file"
>>  			rm -f "$srcdir/$file"
>>  			ln -s "$startdir/$file" "$srcdir/"
>>  			continue
>> -		elif [ -f "$SRCDEST/$file" ]; then
>> +		elif [[ -f "$SRCDEST/$file" ]]; then
>>  			msg2 "$(gettext "Using cached copy of %s")" "$file"
>>  			rm -f "$srcdir/$file"
>>  			ln -s "$SRCDEST/$file" "$srcdir/"
> 
> We could remove the quotes here, too.
> 

Hmmm...  can we.  I know we can when there are spaces in a single 
variable, but for some reason I thought quotes were needed when joining 
multiple variables like that.  I could be wrong...

Allan


More information about the pacman-dev mailing list