From: Bart Schaefer <schaefer@brasslantern.com>
To: <zsh-users@sunsite.dk>
Subject: Re: Parameter expansion flags question
Date: Thu, 11 May 2006 09:38:35 -0700 [thread overview]
Message-ID: <060511093835.ZM13207@torch.brasslantern.com> (raw)
In-Reply-To: <DD74FBB8EE28D441903D56487861CD9D09717293@lonpexch01.citrite.net>
[skipping around a bit]
On May 11, 10:59am, John Cooper wrote:
}
} One final thing - when I entered the "read" example into the shell as
} stated I got syntax errors. These were resolved by using "do" and "done"
} instead of braces - is this to be expected?
Yeah, I messed up. I never use the form with the braces, but you did
in your original "for" sample, so I tried to keep it with "while". I
forgot that for "while" loops it only works when the first condition
is [[ ... ]] or (( ... )).
} Thanks for the detailed reply - it seems using "read" is the most
} straightforward approach. However, in the interests of learning more
} about expansions, I've been trying your suggestions and they don't seem
} to work as expected.
Oh, duh. I spaced that there were multiple lines of output from the
$SITEMGR program. Obviously you need to process each line separately
before applying the subscript.
(This cold I'm coming down with must be affecting me worse than I
thought.)
} If I add the ":#pattern" operator to the original function, the "for"
} loop is still executed once in the case where $SITEMGR produces no
} output:
} delsites4 () {
} for site in "${(f)$($SITEMGR -i):#}"
Placement of the quotes is important:
for site in ${(f)"$($SITEMGR -i)":#}
If it still happens, I think it's because of Cygwin line termination.
Instead of an empty string when splitting with (f), you're getting a
string having a single carriage-return character.
next prev parent reply other threads:[~2006-05-11 16:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-11 9:59 John Cooper
2006-05-11 16:38 ` Bart Schaefer [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-05-15 9:01 John Cooper
2006-05-12 11:02 John Cooper
2006-05-12 14:45 ` Bart Schaefer
2006-05-10 9:22 John Cooper
2006-05-10 17:28 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=060511093835.ZM13207@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).