4

Possible Duplicate:
In Bash, when to alias, when to script, and when to write a function?

I'm trying to setup an alias in my .bashrc file, but it's not working as expected.

I have this alias which works:

alias lolcat='python /home/martyn/Dropbox/Applications/Scripts/logcat-viewer/unixcoloredlogcat.py'

and I normally use this command as such:

adb logcat SomeValue:* *:e | lolcat

But I want to put that in to an alias so that I can write:

logcat SomeValue

but my alias below isn't working - it seems that the $1 isn't coming through - can anyone help me fix this?

alias logcat="adb lolcat $1:* *:E | lolcat"

** FIX **

alias lolcat='python /home/martyn/Dropbox/Applications/Scripts/logcat-viewer/unixcoloredlogcat.py'

function logcat(){ 
    adb lolcat $1:* *:E | lolcat 
}
Martyn
  • 151

1 Answers1

7

There is no mechanism for using arguments in the replacement text, as in csh. If arguments are needed, a shell function should be used. See Bash Reference Manual::6.6 Aliases

enzotib
  • 51,661
Gery
  • 171