dolmen / angel-PS1

Your fancy shell prompt fed by your guardian angel
https://twitter.com/nglPS1
GNU Affero General Public License v3.0
61 stars 3 forks source link

Escape wildcards in shell code #17

Closed dolmen closed 8 years ago

dolmen commented 8 years ago

The shell code generated is evaluated with eval $(angel-PS1) as indicated in the documentation. Due to the use of $( ... ), this code is subject to wildard expansion. And we have a wildcard in the case ... esac block of the bash code. Try this in bash:

touch 'aaaaaa)'
angel-PS1 | tee foo.bash
echo $(cat foo.bash)

=> The "*)" in the shell code is expanded.

A better demonstration of the issue:

$ echo $(echo 'an*')
angel-PS1
dolmen commented 8 years ago

Fixed in bash with 835afbfb19cec6753329d4056244f13507dea900 .

dolmen commented 8 years ago

Zsh 5.0.2 does not seem to have yet the behaviour seen in bash and dash. But I preventively applied the fix also for that shell in 1a701be07baabb8cfc1018daaca4039191c6ba7c .