Can I make bash stop parsing and validating a certain alias?
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.
bash
is interpreting your quoted string, and that interpretation executes the embedded dnf check-update
command. This execution is what takes up the time during the alias definition, not the main dnf updateinfo
command you're aliasing. Try a contrived example based on sleep
and note how the alias
itself takes 5 seconds:
alias sleep5="echo 'wake' ; `sleep 5` ; echo 'done'"
Use single-quotes to avoid the interpretation:
alias releasenotes='dnf updateinfo --refresh info `dnf check-update | cut -d "." -f 1 | xargs` | less'
Don't forget to swap the cut
argument to double-quotes.