Re: Bash argument expanded inside alias

2012-03-16 Thread Chris Davies
rcb wrote: > I think I just learned a lot about functions with this thread, things > I didn't know. > At first I thought the best choice to abbreviate a command would be an > alias, and functions was to encapsulate big chunks of script code. > Never occurred to me I could use it as an alias. It's

Re: Re: Bash argument expanded inside alias

2012-03-15 Thread rcb
> From Chris Davies, Wed, 14 Mar 2012 20:36:43 + > And the function is trivial. Just pop it in your .bashrc >  muda() { local M="$1" D="$2"; find "${D:-.}" -mtime -"${M:-1}"; } > Why are you so reluctant to use functions? Even the bash man page says, > "For almost every purpose, aliases are sup

Re: Bash argument expanded inside alias

2012-03-14 Thread Chris Davies
rcb wrote: > And I can run my alias without using a function, just typing: > $ muda -10 > Unfortunately, you cannot, for example, change the directory with an > argument, because 'find' can't accept a command in an inverted order > like: > $find -mtime -10 /home/kilemal And the function is trivi

Changing subscription from -digest to normal [was: Re: Unnecessary rebooting (was Re: Bash argument expanded inside alias)]

2012-03-14 Thread Andrei POPESCU
On Mi, 14 mar 12, 09:50:11, rcb wrote: > PPS. I think I need to change the list subscription from digest to > normal emails. I tried subject:help to debian-user-request, but the > message that came back was of no help. (Maybe this is offtopic here -- > in this email of course, and in the list in ge

Re: Re: Bash argument expanded inside alias

2012-03-14 Thread rcb
On Tue 13 Mar 2012 15:49:52 +(+), Clive Standbridge wrote: > 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 paramete

Re: Bash argument expanded inside alias

2012-03-14 Thread Camaleón
On Tue, 13 Mar 2012 23:17:41 -0300, rcb wrote: >> From: Camaleón >> Date: Tue, 13 Mar 2012 18:06:11 + (UTC) >> >> > does not work to do what your intuition imagine what I want it to do? >> It's not the alias but the command itself. *** >> alias muda='find . -name "*" -mtime $1' *** >> And pas

Re: Unnecessary rebooting (was Re: Bash argument expanded inside alias)

2012-03-14 Thread Dom
On 14/03/12 12:50, rcb wrote: Dear Camaleón, Unfortunately, this nice command of yours doesn't seem to work. Is it me typing something wrong, or there is really a problem? :~$ alias muda='find $1 -name "*" -mtime $2' :~$ muda /home/cheetara -4 find: invalid arg `-4' for `-mtime' Command line p

Re: Bash argument expanded inside alias

2012-03-14 Thread Chris Davies
rcb wrote: > mudafct() { find . -name "*" -mtime -$1; } Is there any reason why you're using a { -name "*" } part? A quick test suggests that you might as well discard it: mudafct() { find . -mtime -"$1"; } Chris -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subj

RE: Unnecessary rebooting (was Re: Bash argument expanded inside alias)

2012-03-14 Thread rcb
> From: Chris Bannister , Date: Wed, 14 Mar 2012 > 18:00:24 +1300 > > [Please, don't top post in this mailing list] > > Just logout then log back in again, or even better, type: > "source .bashrc" at a command prompt. :) > -- > "Religion is excellent stuff for keeping common people quiet." >   --

Unnecessary rebooting (was Re: Bash argument expanded inside alias)

2012-03-13 Thread Chris Bannister
[Please, don't top post in this mailing list] On Tue, Mar 13, 2012 at 02:47:27PM -0300, rcb wrote: > seems to works inside .bashrc file! (Just 'seems' because I did not > reboot, just typed in a terminal and it worked great!) You shouldn't reboot for changes you make to your .bashrc to take effe

Re: Bash argument expanded inside alias

2012-03-13 Thread rcb
> From: Camaleón > Date: Tue, 13 Mar 2012 18:06:11 + (UTC) > > > does not work to do what your intuition imagine what I want it to do? > It's not the alias but the command itself. > *** > alias muda='find . -name "*" -mtime $1' > *** > And pass the negative value "-n" as argument (e.g., "muda

Re: Bash argument expanded inside alias

2012-03-13 Thread Camaleón
On Tue, 13 Mar 2012 11:34:12 -0300, rcb wrote: (no html, please) > Dear Debian users, > > Anyone knows why this command: > > :~$ alias muda='find . -name "*" -mtime -$1' (...) > does not work to do what your intuition imagine what I want it to do? It's not the alias but the command itself.

Re: Bash argument expanded inside alias

2012-03-13 Thread rcb
oth, Beco. To: debian-user@lists.debian.org Subject: Re: Bash argument expanded inside alias From: Clive Standbridge Date: Tue, 13 Mar 2012 15:49:52 + > 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

Re: Bash argument expanded inside alias

2012-03-13 Thread Clive Standbridge
On Tue 13 Mar 2012 15:49:52 +(+), 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 i

Re: Bash argument expanded inside alias

2012-03-13 Thread Tom H
On Tue, Mar 13, 2012 at 11:49 AM, Clive Standbridge wrote: >> >> 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 wor

Re: Bash argument expanded inside alias

2012-03-13 Thread Tom H
On Tue, Mar 13, 2012 at 10:34 AM, rcb wrote: > > Anyone knows why this command: > > :~$ alias muda='find . -name "*" -mtime -$1' > > and all this variations I tried: > > :~$ alias muda='find . -name "*" -mmin -`echo $1`' > :~$ alias muda='find . -name "*" -mmin `echo -$1`' > :~$ alias muda='find .

Re: Bash argument expanded inside alias

2012-03-13 Thread Clive Standbridge
> 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. You can use