In my .bashrc
I alias bat
if it is installed with [ -f /usr/bin/bat ] && alias cat='bat -pp'
This works fine, but if bat
gets uninstalled, the alias becomes broken, so I was trying to make the alias do the check at runtime, but the below is broken. How can I test for bat
inside the alias?
alias cat='if [ -f /usr/bin/bat ]; then bat -pp $@; else /usr/bin/cat $@; fi'