Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 
}
share|improve this question
add comment

marked as duplicate by Gilles, enzotib, Michael Mrozek Mar 14 '12 at 14:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

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

share|improve this answer
    
Ah - thank you. have added fix to comment –  Martyn Mar 13 '12 at 10:43
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.