Quantcast
Channel: Unix Superhero » cli
Viewing all articles
Browse latest Browse all 6

Shell Tip: Run an aliased command, ignoring the alias (Solution #1)

$
0
0

How Bash Uses Aliases/Commands

First, it will try to find an alias for the given name.  If no alias is found, then it will use the first command in your $PATH by the given name.

Scenario

You set default options for cmd-x by creating an alias with the same name (cmd-x).  In this example, the alias and command are both called “grep”.

$> alias grep="grep --color"

BUT!  What if you want to run grep without the “–color” option?

Solution #1: Wrap the command name in quotes

$> "grep" #...

This is the same situation as Solution #0.  There aren’t any aliases that match “grep” (with quotes).  Also, “grep” wrapped in quotes is just a string that evaluations to grep.  The shell will then find grep in our $PATH and run it normally.



Viewing all articles
Browse latest Browse all 6

Trending Articles