![]() |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Riccardo Magliocchetti wrote, on 26.07.2008 12:19: | Bodo Meissner wrote: |> | case "$DEVICE" in |> | ttyS14) SENDTO=xxxxxx@xxxxxxxxxxxxxxxx;; |> | ttyS0) SENDTO= xxxxxx@xxxxxxxxxxxxxxxx;; |> | *) SENDTO= xxxxxx@xxxxxxxxxxxxxxxx;; |> | esac |> |> Here is a bug in your shell script. The following case statement will |> overwrite any SENDTO value you have set above because it has a |> default(*) case | | I don't think so, bash at least doesn't fall through; * is for the | default when you haven't matched anything before.
Yes, inside one case statement the shell will not fall through to the '*' pattern if every case is terminated by ;;. But since the second case statement in the original shell script has a '*' pattern, it will set a SENDTO value in any case, that means it will overwrite any SENDTO value that has been set in the first case statement. This means the first case statement in the original sript is useless because the second case statement will always overwrite the variable values set by the first one.
If the second case statement did not have a '*' pattern it would not overwrite the SENDO value from the first case statement if none of the specified patterns match.
cheers, riccardo
____________________ HylaFAX(tm) Users Mailing List _______________________ To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*