[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with pattern replacing when STRING is an expandable char
From: |
Andreas Schwab |
Subject: |
Re: Problem with pattern replacing when STRING is an expandable char |
Date: |
Wed, 12 Dec 2007 20:53:43 +0100 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) |
Heinz-Ado Arnolds <arnolds@MPA-Garching.MPG.DE> writes:
> Repeat-By:
> a=111.1
> echo ${a//[0-9]/x}
>
> correctly gives "xxx.x", but
>
> echo ${a//[0-9]/*}
>
> gives a listing of files in current directory.
Only those that contain a period.
> Seems that the "*"
> is expanded before replacing the pattern.
No, it is expanded afterwards, since filename expansion is carried out
after parameter expansion. You need to quote it properly.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."