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?