Re: Expansion of exclamation mark in single quotes in subcommand

2014-04-21 Thread Maxdamantus
On 22 April 2014 04:24, Maxdamantus wrote: > Yeah, I can see what you're saying, but it would probably lead to the > bash-2 behaviour, which didn't observe double quotes. > > Given: echo "$(echo "foo")" > I can't see how it would be desirable for

Re: Expansion of exclamation mark in single quotes in subcommand

2014-04-21 Thread Maxdamantus
ommand, the behaviour changes: it alternates between expanding an non-expanding On 22 April 2014 02:26, Chris Down wrote: > Maxdamantus writes: >> This seems like a bug, but it seems to have been here for a few years >> (from the git repository, bash-3.0 displays this behav

Re: Expansion of exclamation mark in single quotes in subcommand

2014-04-21 Thread Maxdamantus
> With history expansion enabled (set +H): That should have been -H (+H disables it).

Re: Expansion of exclamation mark in single quotes in subcommand

2014-04-21 Thread Maxdamantus
After looking into the code, it turns out it's because history_expand basically works as a finite state machine to determine whether it should expand occurances of ! it runs into, so of course can't handle subcommands (more specifically, quotes inside quotes). This leads to interesting patterns tho

Expansion of exclamation mark in single quotes in subcommand

2014-04-21 Thread Maxdamantus
version: 4.3.11(5) This seems like a bug, but it seems to have been here for a few years (from the git repository, bash-3.0 displays this behaviour while bash-2.05b doesn't). With history expansion enabled (set +H): $ echo '!!' # good !! $ echo "$(echo '!!')" # not good; !! expands echo "$(echo