That was great, much clearer now, thanks!

I would very much like to learn bash programming, any suggestions on
good resources?

Thanks again.

Jamie Adams
Housing Assistant
---------------------------------
Tel:  (01723) 507543
Fax: (01723) 355862


>----------
>From:  [EMAIL PROTECTED][SMTP:[EMAIL PROTECTED]]
>Reply To:      [EMAIL PROTECTED]
>Sent:  25 August 2001 04:56
>To:    [EMAIL PROTECTED]
>Subject:       Re: [newbie] File Renaming "Perks:  Did someone say 'bash
>
><<File: message.txt>>
>> This is a newbie list right? [okay, good]  I don't want to be too
>> embarassed to ask a stuped question.  Would someone be willing to
>> explain what this does?  I mean each character has significance, right?
>> So what is it?  This reminds me of the random characters thrown up on
>> my screen after disconnecting from the old  BBS.
>
>or apl :)
>
>Well, I'll take a stab at it - but I would think that there is a 
>cleaner way to write this.
>
>
>> At 08:34 PM 8/22/2001 -0700, you wrote:
>> > > for i in `ls /dirname | grep -e".+ .+"`; do mv $i `echo $i |
>> >  gawk '{ gsub(_, ,$0) }'` ; done
>
>Well, the 'for i in ' ... construct is going to do something for every
>member of the list. For instance:
>
>for i in 'apple pear peach'
>do 
>  echo i ate a $i
>done
>
>Well, that would print out:
>
>i ate a apple
>i ate a pear
>i ate a peach
>
>So, the for iterates over lists, rather than taking on a series of 
>sequential values (as in basic and other programming languages).
>
>Stuff in ` ` (back quotes) get interpreted and substituted right into
>the command line. In other words, another process is going out and building
>the list that the for is going to use. I'm not certain about the grep -e
>" .+  .+" part - but it would appear the object is to get a list of files,
>and ls -l returns a long list of those. One of course can simplify this to
>for i in `ls` or eevn for i in *, which returns all files in the directory -
>try 'echo *' at your shell sometime.
>
>So, if we simplify the first construct, it is going to present a new
>filename from the directory and iterate over the full list of files, so
>something will be done to each file name. The something is in the next
>line - the 'mv $i `...` part. Here we also have another use of backquotes:
>the intent is to take the filename we're currently using ($i), and do some
>awk processing on it. Using 'tr' would be far simpler :). The result of
>the awk processing is then put on the command line, which becomes the
>new filename for the 'mv' command.
>
>> Dean
>------------------------------------------------------------------------
>David E. Fox                              Thanks for letting me
>[EMAIL PROTECTED]                            change magnetic patterns
>[EMAIL PROTECTED]               on your hard disk.
>-----------------------------------------------------------------------
>
>
>
>_____________________________________________________________________
>This message has been checked for all known viruses by Star Internet
>delivered through the MessageLabs Virus Scanning Service. For further
>information visit http://www.star.net.uk/stats.asp or alternatively call
>Star Internet for details on the Virus Scanning Service.
>

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://wwww.mandrakestore.com

Reply via email to