Re: Appreciate advice on %if %foo || %bar syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tim Mooney skrev, on 30-08-2007 23:11:
In regard to: Re: Appreciate advice on %if %foo || %bar syntax, Tony...:

%define is_rhel5 %(test -f /etc/redhat-release && cat /etc/redhat-release | egrep -q 'release 5' && echo 1 || echo 0)

Thanks from somebody else :)

Quite another thing is, that a more rational test would be something like:

"test -f /etc/redhat-release && grep 'release 5' /etc/redhat-release &&
echo 1 || echo 0"

Except you probably want the -q option to grep, otherwise your macro might
end up resulting in

    release 51

Might, only tried it at the CLI and it works as expected there. The '-q' is only for "silent", equivalent to " > /dev/null 2>&1". It won't affect output.

Getting rid of the useless cat was a good move, but I don't see any reason
to prefer grep over egrep here.

People who use egrep should understand what it's good for. People who use egrep should understand and be able to use Posix regexps. Using egrep where grep will do is redundant.

Best,

--Tonni

--
Tony Earnshaw
Email: tonni at hetnet dot nl

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux