Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
string overwrites string when echoed
- X-seq: zsh-users 22873
- From: Emanuel Berg <moasen@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: string overwrites string when echoed
- Date: Sat, 09 Sep 2017 14:55:23 +0200
- Cancel-lock: sha1:9OS+ocLl4o+5RlRx4wga3J6gG1g=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-copies-to: never
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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