Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: tlug: Re: file counting
- To: tlug@example.com
- Subject: Re: tlug: Re: file counting
- From: Hernando TANAKA <ktanaka@example.com>
- Date: Mon, 12 Oct 1998 13:56:12 -0600
- Content-Transfer-Encoding: 7bit
- Content-Type: Text/Plain; charset=us-ascii
- In-Reply-To: Your message of "Mon, 12 Oct 1998 22:21:51 +0900 (JST)"<XFMail.981012222151.schweiz@example.com>
- References: <XFMail.981012222151.schweiz@example.com>
- Reply-To: tlug@example.com
- Sender: owner-tlug@example.com
> > Are you sure that you can use tokens like $1 in an alias? > > It IS acting wierd and yes, $1 does work: No, if you're using bash, you may not use argument substitution. The reason why the "psg" sample; > schweiz:~$ alias psg > alias psg='ps -aux | grep $1' > schweiz:~$ psg schweiz > schweiz 831 0.0 3.5 94 388 pp0 S 21:48 0:00 -bash is working is because the $1 is the last argument, which is usually unset in the interactive shell, so it's neglected by bash. I.e., input--> psg schweiz expanded--> ps -aux | grep schweiz Your "find" example, alias numf='find $1 -type f | wc -l' would be interprited like this; input--> numf ~/Mail expanded--> find -type f | wc -l ~/Mail If you want to handle arguments in bash, you should use a script file as you've done in the first place, OR write a function in your ~/.bashrc like; numf() { find $1 -type d | wc -l } Here's the quotation from `man bash'; There is no mechanism for using arguments in the replace- ment text, as in csh. If arguments are needed, a shell function should be used. --- Kenichiro TANAKA --------------------------------------------------------------- Next Nomikai: 20 November, 19:30 Tengu TokyoEkiMae 03-3275-3691 Next Meeting: 12 December, 12:30 Tokyo Station Yaesu central gate --------------------------------------------------------------- Sponsor: PHT, makers of TurboLinux http://www.pht.co.jp
- Follow-Ups:
- Re: tlug: Re: file counting
- From: Hernando TANAKA <ktanaka@example.com>
- Re: tlug: Re: file counting
- From: Jim Schweizer <schweiz@example.com>
- References:
- Re: tlug: Re: file counting
- From: Jim Schweizer <schweiz@example.com>
Home | Main Index | Thread Index
- Prev by Date: Re: My *beepin* 486 (was Re: tlug: The meeting...)
- Next by Date: No Subject
- Prev by thread: Re: tlug: Re: file counting
- Next by thread: Re: tlug: Re: file counting
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links