Reputation: 18627
I've often been tempted with the idea of using an alias to modify the default behavior of a command line tool. For example, I often want to resolve the actual path after following a symlink (and have never wanted to maintain the symlink path), so I was thinking about adding something to my .bash_profile file, to make this the default behavior, e.g.:
alias cd="cd -P"
Is this bad or dangerous for any reason? If not for this example, is it a bad idea in general? It makes me feel a little dirty...
Upvotes: 2
Views: 288
Reputation: 3522
It's a very common technique. Here are some common examples.
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias ls='ls --color=auto'
alias make='make -j20'
If later you want to run without the alias you can \ the first letter or put the command in quotes, as in
\ls
"ls"
Upvotes: 2
Reputation: 152
On every *NIX system I always use alias cd..='cd ..'
I say if it helps you in the long run there's no need to feel dirty - computers are supposed to do what we tell them to do, not the other way round..
Upvotes: 1