How can I check in my .bashrc if an alias was already set.
When I source a .bashrc file, which has a function name, say fun, and my current environment has an alias as fun also.
I tried unalias fun, but that will give me an error that fun not found when my environment wont have that alias already.
So in my .bashrc, in my fun function I want to check if alias was set, then unalias that.
If you just want to make sure that the alias doesn’t exist, just unalias it and redirect its error to /dev/null like this:
You can check if an alias is set with something like this:
As stated in the manpage: