Hi,

On 10/01/16 06:42 AM, bittorf wireless )) Bastian Bittorf wrote:
+
+start() {
+       if [ -e /dev/rtc ]; then
+               hwclock -s

please use the short form [ -e /dev/rtc ] && ...


Per private mail I've learned this is the current codebase standard, so will follow that, but the reason I tend to prefer the if..then is that if..then has the correct semantics when using set -e (that is causes termination on error, but not under normal operation) whereas [ xx ] && yy is not set -e safe and simply adding || true results in error conditions not being detected, so it is actually doing the wrong thing if you use set -e (unless the initial condition being false is an error and not just normal operation).

Regards,

Daniel
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to