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

Re: Bash argument expanded inside alias



On Tue 13 Mar 2012 15:49:52 +0000(+0000), Clive Standbridge wrote:
> > Dear Debian users,
> > 
> > Anyone knows why this command:
> > 
> > :~$ alias muda='find . -name "*" -mtime -$1'
> > 
> > and all this variations I tried:
> [...]
> > does not work to do what your intuition imagine what I want it to do?
> 
> Hi Beco,
> 
> It doesn't work because aliases don't take arguments.

Oh I think I misunderstood the question.
On second thoughts, I think you probably meant to use an alias inside
a shell script, and to use the script's argument in the alias. In that
case, the problem would be shell parameters are not expanded inside
single quotes. You would need to use double quotes, for example

alias muda="find . -name '*' -mtime -$1"


-- 
Cheers,
Clive


Reply to: