[pacman-dev] [PATCH 7/9] repo-add: avoid using ls to check for presence of files

Martti Kühne mysatyre at gmail.com
Fri Jun 24 09:43:31 EDT 2011


On Fri, Jun 24, 2011 at 6:34 AM, Dave Reisner <d at falconindy.com> wrote:
> On Thu, Jun 23, 2011 at 11:06:45PM -0500, Dan McGee wrote:
>> On Wed, Jun 22, 2011 at 7:38 PM, Dave Reisner <d at falconindy.com> wrote:
>>
>> I agree with the commit message, but damn is this ugly. Can't we drop
>> the whole nullglob bit and just do something like:
>>
>> contents=*
>> if [[ $contents = "*" ]]; then

martti at deepthought:~/test$ touch \*
martti at deepthought:~/test$ contents=(*)
martti at deepthought:~/test$ echo "${contents[*]}"
*
martti at deepthought:~/test$ echo ${#contents}
1

Don't approve. Dave's version fails if there's a valid file called
'*', as little as it's probable.
Better do bash ugly and safe. :)


More information about the pacman-dev mailing list