Make bash stop parsing and validating a certain alias

bashbash-aliasbashrc

I'm using Fedora 25, and have added the following alias to my bash profile:

alias releasenotes="dnf updateinfo --refresh info `dnf check-update | cut -d '.' -f 1 | xargs` | less"

(I can't use straight-up dnf updateinfo info because of https://bugzilla.redhat.com/show_bug.cgi?id=1405191)

My alias works, but the command takes about 10 seconds to run, and since bash parses and validates all aliases when the profile is sourced, creating a new shell results in a 10-second hang. This is annoying.

Is there any way to make bash not try to parse and validate aliases–or just that one?

Best Answer

My best guess is you should probably use single quotes around the alias definition.

I know that when using double quotes, shell variables are replaced with their content at the alias definition stage (like you said parsing and validating) and backticks or shell substitution like $(command).

A better explanation is in this Unix SE question!

If that doesn't help making the prompt load faster again, define a shell function instead of an alias.

edit: Don't forget to swap the cut argument to double-quotes like quixotic mentioned.

Related Question