Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Bug Report: Env Vars and shell functions



Note: I'm not a member of any of the mailing lists

Greetings,

	Can others reproduce this bug in zsh-3.0-pre2, where a command
line environment variable is ignored in other functions called by the
original functions. Very trivial double function calls seem to work
fine but some where the code in "allLogicalHosts" seems to upset the
second function call. This code has been stripped a bit but not
completely, those wish to construct a similar directory structure, can
or alternatively you can comment out the eval line and use the
explicit variable set on the line below that in "allLogicalHosts".

	History: Early beta version of zsh-2.6 ( < beta-9 ?? ) worked
but it was broken somewhere and fixed was introduced in beta-1X
according to the changelogs, unfortunately I didn't have the time to
test all the new beta versions

Regards,
Peter

------------------------------------------------------------------------------
Peter Bray: Intelligent Network Development           Phone : (02) 395 3958
            Network Technology Group - Telstra        Fax   : (02) 395 3225
Street    : Lvl 9, Telecom Plaza, 320 Pitt St, Sydney Email : 
Mail      : Locked Bag 6581, GPO Sydney, NSW, 1100     pbray@xxxxxxxxxxxxxxxx
------------------------------------------------------------------------------

Environment : SPARC Solaris 2.5 & 2.5.1 - zsh 3.0pre2

[pbray@swan] /tmp > du -k /tmp/tsaf 
4       /tmp/tsaf/a@b/current
8       /tmp/tsaf/a@b
4       /tmp/tsaf/xxx@yyy/current
8       /tmp/tsaf/xxx@yyy
20      /tmp/tsaf

[pbray@swan] /tmp > source /tmp/zshenv 
TSAF_VERBOSE --> echo   Arguments --> a@b current
TSAF_VERBOSE --> echo   Arguments --> xxx@yyy current

###############  ^^^^ why isn't this a ":"

[pbray@swan] /tmp > cat /tmp/zshenv 
#
# Example Directory Structure
#       ${prefix}/a@b/current
#       ${prefix}/a@b/backup
#       ${prefix}/xxx@yyy/current
#       ${prefix}/xxx@yyy/backup
#

setLogicalHost()
{
    TSAF_VERBOSE=${TSAF_VERBOSE:-echo}
    echo "TSAF_VERBOSE --> ${TSAF_VERBOSE}      Arguments --> $*"
}

allLogicalHosts()
{
    prefix=/tmp/tsaf
    version=${1:-current}

    ## Comment out one off the two lines below 
    eval 'hostList=`echo ${prefix}/*@*`' 2>/dev/null
    #hostList="a@b c@d"

    for logicalHost in `echo ${hostList}`
    do
        setLogicalHost `basename $logicalHost` ${version}
    done
}

TSAF_VERBOSE=: allLogicalHosts




Messages sorted by: Reverse Date, Date, Thread, Author