Re: referring to arguments in bash aliases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Timothy Stone wrote:

List,

tcsh user moving to bash.

What is the bash equivilent to:

alias llm 'ls -l \!* | less'

I got this far:

alias llm="ls -l | less"

How do I perform things like: \!*, \!^, \!$, \!:n ? Is it as simple as $1? How do I refer to the first or last arguments (\!^ and \!$ in tcsh)?

Hmmm... man bash states that, "There is no mechanism for using arguments in the replacement text. If arguments are needed, a shell function should be used (see FUNCTIONS below)."


Boo. :( Now, how do I write a simple shell function in bash?

I've got this far:

llm() { }

It's a start right? ;) Am I headed down the right path? Did I read to much between the lines in the man pages for bash? Nothing on the web dives this far into aliases in bash. Much seems to skip arguments in the alias' replacement text.

Again,

Many thanks in advance, Tim


--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux