Hi all,
Webalizer is enabled via /etc/sysconfig/webalizer but I don't understand why /etc/cron.daily/00webalizer has this line:
[ "z$WEBALIZER_CRON" != "zyes" ] && exit 0
that I think it should be (and it is working this way)
[ "$WEBALIZER_CRON" != "yes" ] && exit 0
What is the mistery?
C.Sava
On Fri, 2013-04-26 at 15:36 +0300, Cristian Sava wrote:
Hi all,
Webalizer is enabled via /etc/sysconfig/webalizer but I don't understand why /etc/cron.daily/00webalizer has this line:
[ "z$WEBALIZER_CRON" != "zyes" ] && exit 0
that I think it should be (and it is working this way)
[ "$WEBALIZER_CRON" != "yes" ] && exit 0
What is the mistery?
The "z$Foo" != "zbar" style is idiomatic in Shell scripts. I think it's to ensure portability between Shells with slightly different expression rules.
poc
On Fri, 2013-04-26 at 09:12 -0430, Patrick O'Callaghan wrote:
On Fri, 2013-04-26 at 15:36 +0300, Cristian Sava wrote:
Hi all,
Webalizer is enabled via /etc/sysconfig/webalizer but I don't understand why /etc/cron.daily/00webalizer has this line:
[ "z$WEBALIZER_CRON" != "zyes" ] && exit 0
that I think it should be (and it is working this way)
[ "$WEBALIZER_CRON" != "yes" ] && exit 0
What is the mistery?
The "z$Foo" != "zbar" style is idiomatic in Shell scripts. I think it's to ensure portability between Shells with slightly different expression rules.
poc
Thank you very much.
C.Sava
On 26Apr2013 09:12, Patrick O'Callaghan pocallaghan@gmail.com wrote: | On Fri, 2013-04-26 at 15:36 +0300, Cristian Sava wrote: | > Webalizer is enabled via /etc/sysconfig/webalizer but I don't understand | > why /etc/cron.daily/00webalizer has this line: | > | > [ "z$WEBALIZER_CRON" != "zyes" ] && exit 0 | > | > that I think it should be (and it is working this way) | > | > [ "$WEBALIZER_CRON" != "yes" ] && exit 0 | > | > What is the mistery? | | The "z$Foo" != "zbar" style is idiomatic in Shell scripts. I think it's | to ensure portability between Shells with slightly different expression | rules.
In particular it avoids issues where $WEBALIZER_CRON looks like a test operator such as "-z" or something unfortunate.
04/27/2013 03:49 PM, Cameron Simpson wrote:
On 26Apr2013 09:12, Patrick O'Callaghan pocallaghan@gmail.com wrote: | On Fri, 2013-04-26 at 15:36 +0300, Cristian Sava wrote: | > Webalizer is enabled via /etc/sysconfig/webalizer but I don't understand | > why /etc/cron.daily/00webalizer has this line: | > | > [ "z$WEBALIZER_CRON" != "zyes" ] && exit 0 | > | > that I think it should be (and it is working this way) | > | > [ "$WEBALIZER_CRON" != "yes" ] && exit 0 | > | > What is the mistery? | | The "z$Foo" != "zbar" style is idiomatic in Shell scripts. I think it's | to ensure portability between Shells with slightly different expression | rules.
In particular it avoids issues where $WEBALIZER_CRON looks like a test operator such as "-z" or something unfortunate.
Also there may be situations where $SOME_VAR evaluates to null. Then a test looks like [ != "something" ] which is guaranteed to break. By (pre|post)fixing each side with an arbitrary character such as Z that same scenario would yield [ "Z" != "Zsomething" ] and would survive shell parsing.
On 27Apr2013 16:41, Mike Wright mike.wright@mailinator.com wrote: | 04/27/2013 03:49 PM, Cameron Simpson wrote: | >On 26Apr2013 09:12, Patrick O'Callaghan pocallaghan@gmail.com wrote: | >| On Fri, 2013-04-26 at 15:36 +0300, Cristian Sava wrote: | >| > [ "z$WEBALIZER_CRON" != "zyes" ] && exit 0 [...] | >| The "z$Foo" != "zbar" style is idiomatic in Shell scripts. I think it's | >| to ensure portability between Shells with slightly different expression | >| rules. | > | >In particular it avoids issues where $WEBALIZER_CRON looks like a test | >operator such as "-z" or something unfortunate. | | Also there may be situations where $SOME_VAR evaluates to null. | Then a test looks like [ != "something" ] which is guaranteed to | break.
It's quoted. That will stop it vanishing.