Categories
Coding

Ignoring Bash Aliases

If you have any aliases defined in your .bashrc or .bash_profile files, occassionally you may run into a situation where you would like to selectively ignore those aliases. In my shell, I have aliased ls like so:

alias ls ‘ls -lF –color’

However, when running a simple command like the following (which searches for filenames within a set of jar files), this breaks, as the output of ls is in long format. Instead of having to use cut or awk to slice off the parts of the output we need, we can escape the aliased command, effectively telling bash to ignore the alias:

for j in $(\ls *.jar); do jar tvf $j | grep -i “gfxjavactask” ; done

Note the \ in front of the command name. This is an obscure one, I know! 🙂