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 

1 Answer 1


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

  • Ah - thank you. have added fix to comment
    – Martyn
    Mar 13, 2012 at 10:43

Not the answer you're looking for? Browse other questions tagged .