[Nottingham] Quick! I need a bash one liner!

Michael Erskine msemtd at yahoo.co.uk
Wed Feb 2 08:56:42 GMT 2005


On Tuesday 01 February 2005 21:37, Johannes Kling wrote:
> > for file in *.[ch]; do expand -t 4 $file > t1; mv t1 $file; done
>
> Isn't that just your original script re-written using ';' instad of
> newlines? I.e. No more of a one-liner than:

Yes...

What I mean by "one-liner" is being able to issue the commands at the prompt 
rather than written in a file. Although I knew it could be done, I hadn't yet 
learned the proper bash "for fileglob, do, done" construct and where to stick 
the semicolons; I was getting all sorts of funky side-effects as a result of 
my attempts too: e.g. I managed to create a file called "*.[ch]"!!!  

Now, thanks to all the list input, I'm a little more adept with bash and I'm 
more likely to reach for it rather than reach for the bottle :) . Whatever 
the weather, it beats working!

Regards,
Michael.


-- 
Basically my wife was immature.  I'd be at home in the bath and she'd
come in and sink my boats.
  -- Woody Allen



More information about the Nottingham mailing list