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

string overwrites string when echoed



Here is a problem that really puzzles me.
I re-wrote the original DWIM function, that
branched on $#, into two function to identify
the issue. Now I know where the issue is - the
commented lines - but not why it
happens. Ideas?

TIA.

url-exists () {
    local url=$1
    curl -s -I $url | head -n 1 | cut -d\  -f2,3,4
}
alias url=url-exists

urls-exist () {
    local -a urls
    urls=($@)

    local reply
    for u in $urls; do
        reply=$(url $u)
        echo "$u $reply" # works
        echo "$reply $u" # doesn't work, $u overwrites $reply
    done
}
alias urls=urls-exist

-- 
underground experts united
http://user.it.uu.se/~embe8573



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