bug-bash
[Top][All Lists]
Advanced

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

Re: [Parameter Expansion] bug in ${variable% *}


From: Greg Wooledge
Subject: Re: [Parameter Expansion] bug in ${variable% *}
Date: Tue, 12 Feb 2013 08:45:15 -0500
User-agent: Mutt/1.4.2.3i

On Tue, Feb 12, 2013 at 02:37:03PM +0100, Dashing wrote:
> For my purposes this is irrelevant, because the nature of the 
> script from which my example code derived is tab completion. 
> READLINE_LINE will contain mplayer foo1\ foo2\ etc.

Then you are still doing something wrong.

imadev:~$ args Tori\ Amos\ -\ Mr.\ Zebra.ogg 
1 args: <Tori Amos - Mr. Zebra.ogg>

There are no literal backslashes in an argument that is produced by
tab completion.  The backslashes are a form of quoting, and they are
removed by the calling shell during the quote removal phase.

If you believe you have found a bug in parameter expansion, then
simplify the example so that it directly demonstrates the bug.  For
example,

foo='some thing with \ \ \ \ backslashes'
echo "${foo##* }"
echo "I expected to see 'blah'"

If you are playing around with read -e, then your script should CONTAIN
that.  And if you are reading shell commands in a shell script using
read -e and then attempting to parse them the way a shell would, then you
should reevaluate your goals, or the methods you are attempting to use to
attain them, because writing a shell in a shell is kinda wonky, isn't it?



reply via email to

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