bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue with parameter and command substitution in case statement


From: Andreas Schwab
Subject: Re: Issue with parameter and command substitution in case statement
Date: Sat, 23 Aug 2008 10:20:17 +0200
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/22.2 (gnu/linux)

John <address@hidden> writes:

>         Take, for example, the string "1|2".  when used in the form case 2 in 
> \ 1|2) ... the function execute_case_command, in the strmatch line.  This 
> line is executed twice, once being a strmatch (2,1) and the other being 
> strmatch (2,2).  Obviously the 2,2 is the match.
>
>         On the other hand, when a variable VAR='1|2' is used (case 2 in $var 
> ... ) the comparison performed is strmatch (2,1|2) which fails.  1|2 is never 
> broken into its components.

Meta characters that are part of the shell syntax are only recognized
when literal characters, not when part of an expansion.  You can get
around that rule by using eval, which rereads the argument as input to
the shell.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
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."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]