If I alias a keyword, I can't figure out how to bypass it.
$ alias if='echo "GOTCHA!"; if'
$ if true; then echo y; fi
GOTCHA!
y
The usual tools for bypassing an alias, like escaping, command, and builtin, don't work.
$ \if true; then echo y; fi
bash: syntax error near unexpected token `then'
$ 'if' true; then echo y; fi
bash: syntax error near unexpected token `then'
$ command if true; then echo y; fi
bash: syntax error near unexpected token `then'
$ builtin if true; then echo y; fi
bash: syntax error near unexpected token `then'
I would use unalias, but the thing is, I'm putting this code in a function that specifically gets info about aliases (among other commands in an interactive session), so I can't just unset it.
$ unalias if # or `unalias -a` to be indiscriminate
$ if true; then echo y; fi
y
$ alias if # I still want to see how the alias is defined, but now it's gone.
bash: alias: if: not found
So, how can I bypass an alias that overrides a keyword, without fully unsetting it?