Re: Iterating over multiple arguments
From: Chris F.A. Johnson (c.fa.johnson_at_rogers.com)
Date: 01/16/04
- Next message: Peter Köhlmann: "Re: Video Editing in Linux?"
- Previous message: Chris F.A. Johnson: "Re: sorting filenames"
- In reply to: Dances With Crows: "Re: Iterating over multiple arguments"
- Next in thread: Dances With Crows: "Re: Iterating over multiple arguments"
- Reply: Dances With Crows: "Re: Iterating over multiple arguments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 15 Jan 2004 23:51:49 GMT
On Thu, 15 Jan 2004 at 23:15 GMT, Dances With Crows wrote:
> This also works:
>
> samantha:~$ for ARG in one two three ; do
>> echo $ARG
>> done
>
> (If you enter "for ARG in one two three<ENTER>" you'll get a syntax
> error.
Since when?
I use that frequently, in shells from Bourne shell to bash and
ksh; haven't had a syntax error yet.
> Terminate the list with ; , then add the do, and things will
> work as expected.)
>
>> I have tried the syntax you showed me on the bash shell, but it won't
>> work.
>
> The commands you use in bash are both scriptable and enterable one at a
> time from an interactive shell. Something that trips people up in some
> cases is the need to insert ; after every "line" when you're entering a
> command like the first one I wrote where it's all on one line. This is
> just the way bash is; there are other shells and scripting languages,
> and you may find another one more suited to the way you like to do
> things. (I like Perl for doing more complex things, but YMMV.) HTH,
>
--
Chris F.A. Johnson http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2004, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
- Next message: Peter Köhlmann: "Re: Video Editing in Linux?"
- Previous message: Chris F.A. Johnson: "Re: sorting filenames"
- In reply to: Dances With Crows: "Re: Iterating over multiple arguments"
- Next in thread: Dances With Crows: "Re: Iterating over multiple arguments"
- Reply: Dances With Crows: "Re: Iterating over multiple arguments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|