[Bug 407] assign local vars and catch returncode

bugzilla at busybox.net bugzilla at busybox.net
Sat Jun 20 11:47:00 UTC 2009


https://bugs.busybox.net/show_bug.cgi?id=407





--- Comment #5 from Bastian Bittorf <busybox.20.bastian at spamgourmet.org>  2009-06-20 11:46:59 UTC ---
> clear.  instead of talking in pseudo code, post a small example of real code

_phonebook_get ()
{
    local NAME="$1"
    local NUMBER

    # returns a valid phonenumber, if entry exists
    # otherwise returns false

    ...
}

_send_sms ()
{
    local DESTINATION="$1"
    local TEXT="$2"
    local PROVIDER="$( uci get system.service.sms.provider )"

    local NUMBER="$( _phonebook_get $DESTINATION )" || {
                         logger "user '$DESTINATION' unknown"
                         return 1
                 }

    _send_sms_$PROVIDER "$NUMBER" "$TEXT"
}

> the handling of local in hush should match bash because (1) local is not in
> POSIX so we have no official spec and (2) bash is the most widely used shell,
> so differing in behavior is just brain dead.

hmm, I understand your argument - but I still think, that BASH
is in this case not correctly implemented. Close the ticket, I
have to open a ticket @bug-bash....


-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list