OT: Shell Script

Denis Beauchemin Denis.Beauchemin at USherbrooke.ca
Wed Feb 8 18:42:00 GMT 2006


Alex Neuman van der Hans wrote:

> Up to recently I'd do a sync;sync;shutdown [parameters]...
>
> Glenn Steen wrote:
>
>>On 08/02/06, Tim Sailer <sailer at bnl.gov> wrote:
>>  
>>
>>>On Wed, Feb 08, 2006 at 12:08:19PM +0100, Glenn Steen wrote:
>>>    
>>>
>>>>On 07/02/06, Tim Sailer <sailer at bnl.gov> wrote:
>>>>(snip)
>>>>      
>>>>
>>>>>for file in `echo *`
>>>>>        
>>>>>
>>>>(snip)
>>>>Tim, just curious... Why do you go the "long route around" backticks
>>>>and an echo, just to use the same shell "wildcarding" mechanism as a
>>>>single "*" would give you?
>>>>That cannot be necessary... Just use an * and you'll be fine... As in
>>>>...
>>>>for file in *
>>>>do
>>>>      
>>>>
>>>Well, yes, for the most part. I guess I'm just showing my age, unix-wise.
>>>Back in the good old days with the standard Bourne shell, globbing didn't
>>>quite work like the present.
>>>    
>>>
>>In the far reaches of my memory, I do beleive you might be right:-).
>>Not so any more though;).
>>
>>  
>>
>>>Plus, * by itself means a lot of things to
>>>the shells.
>>>    
>>>
>>Not really;).
>>
>>  
>>
>>>Evaling the results of the 'echo -n' and '-n' by itself may
>>>have different results, if a file was created with the name '-n'.
>>>    
>>>
>>Again, not really, at least not any more... If you're after
>>"pathifying" them, using ./* or a find would do the trick (only real
>>way of defeating "option-like" filenames)... Otherwise the -n filename
>>would be lost to the echo.
>>
>>  
>>
>>>Habit, I guess. After all these years, that sequence just flows off
>>>my fingertips...
>>>    
>>>
>>
>>I'm sure I do my share of "old crud typing" too... For years (hm, more
>>like "decade(s)", come to think of it) I was guilty of "the tripple
>>sync before shutdown" on systems that simply didn't need them...:-)
>>
>>Thanks for the answer.
>>--
>>-- Glenn
>>email: glenn < dot > steen < at > gmail < dot > com
>>work: glenn < dot > steen < at > ap1 < dot > se
>>  
>>

I too learned many years ago on somewhat limited versions of Unix: 
Venix, Berkeley, AT&T, SunOS.  But the current Linux distros are much 
better than those old versions.

For example, I used to "tar cf - * | (cd /some-other-dir; tar xvfB -)" 
to copy from one dir to the other; now I do a "cp -a * /some-other-dir"!

I also used to "sync;sync;halt", but now I can just "halt".

The "diff -r" is also handy in comparing directory trees (goes recursively).

I also love bash's Esc-. that recalls the last parameter typed on the 
previous command line, and Ctrl-R that searches back in the command 
history...

And there is also vim-enhanced that uses color to help us code more 
easily...

Denis

-- 
   _
  °v°   Denis Beauchemin, analyste
 /(_)\  Université de Sherbrooke, S.T.I.
  ^ ^   T: 819.821.8000x2252 F: 819.821.8045


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3226 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.mailscanner.info/pipermail/mailscanner/attachments/20060208/53be8140/smime.bin


More information about the MailScanner mailing list