SOURCES: service_generator.sh - use == instead of = for tests

Radoslaw Zielinski radek42 at gmail.com
Wed Jun 21 12:25:43 CEST 2006


Jakub Bogusz <qboosh at pld-linux.org> [21-06-2006 11:32]:
> On Sun, Jun 11, 2006 at 07:02:34PM +0200, radek wrote:
>> Author: radek                        Date: Sun Jun 11 17:02:34 2006 GMT
>> Module: SOURCES                       Tag: HEAD
>> ---- Log message:
>> - use == instead of = for tests

> Why? "=" is standard test operator.
[...]
>> -if [ $action = stop ]; then
>> +if [ "$action" == "stop" ]; then

The commit message should be different, I wanted to fix this:

  $ cvs up -r1.5 service_generator.sh
  P service_generator.sh

  $ sh service_generator.sh foo >/dev/null
  service_generator.sh[16]: [: stop: unexpected operator/operand

I wasn't sure if "=" is preferred to "=="; as I find the former
ambigous, I changed it too.  POSIX indeed defines only "=" while
describing "test", but section 1.7.2 lists "==" ("Concepts Derived
from the ISO C Standard"), so I guess it can also be considered
conformant.


[ I've replied directly by mistake, sending again here. ]

-- 
Radosław Zieliński <radek at pld-linux.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /mailman/pipermail/pld-devel-en/attachments/20060621/45ec832d/attachment.sig 


More information about the pld-devel-en mailing list