[pacman-dev] [PATCH 1/2] Changing [ to [[ and ((
Allan McRae
allan at archlinux.org
Thu Nov 12 18:03:08 EST 2009
Isaac Good wrote:
> On Thu, Nov 12, 2009 at 07:16:41PM +0000, Cedric Staniewski wrote:
>>> @@ -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/"
>
> What about something like this?
>> if [[ "$(check_option makeflags)" = "n" ]]; then
>
> None of the quotes are needed. I'm inclined to replace it with:
>> if [[ $(check_option makeflags) = "n" ]]; then
>
> While the quotes around n are not needed, they highlight that n is a string which appeals to me since it looks like a string as found in other languages. Or would you say to drop all the quotes.
>
Aren't the quotes around the string on the right required if it does
contain spaces? Anyway, I would prefer all such strings to be quoted so
I am happy with your suggestion.
Allan
More information about the pacman-dev
mailing list