Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: Parameter expansion flags question
- X-seq: zsh-users 10265
- From: "John Cooper" <john.cooper@xxxxxxxxxxxxx>
- To: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>, <zsh-users@xxxxxxxxxx>
- Subject: RE: Parameter expansion flags question
- Date: Mon, 15 May 2006 10:01:36 +0100
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Thread-index: AcZ10sGySQdhosY1Sle2cQcJzcPSMQCK12ug
- Thread-topic: Parameter expansion flags question
Ah, I see. Thanks again for all the help.
--- John
-----Original Message-----
From: Bart Schaefer [mailto:schaefer@xxxxxxxxxxxxxxxx]
Sent: 12 May 2006 15:45
To: zsh-users@xxxxxxxxxx
Subject: Re: Parameter expansion flags question
On May 12, 12:02pm, John Cooper wrote:
} Subject: RE: Parameter expansion flags question
}
} > Placement of the quotes is important:
} > for site in ${(f)"$($SITEMGR -i)":#}
}
} OK, changing the placement of the quotes to the above fixes it.
There's
} just one thing I'm a little puzzled about - in the case where $SITEMGR
} produces no output, won't "$($SITEMGR -i)" be the empty string? If so,
} why is :# needed? It seems it will just replace an empty string with
} another empty string?
It's the same as the difference between
string=""
array=( word "$string" word )
print $#array
and
string=""
array=( word $string word )
print $#array
An unquoted empty string is discarded; a quoted empty string is
retained.
Effectively the :# construct discards the quoted empty string, leaving
an
unquoted one in its place, which the shell in turn discards when
building
the final array.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author