[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: wasted disk space



On Tue 03 Oct 2000, Philip Brown wrote:

> > bash lets you do great stuff : for i in /dev/sda{1,5,6,7} is faster
> 
> sh is pretty cool too, dont forget :-)
> 
> Get in the habit of using POSIX compliant syntax for shellscripts.
> It will help everyone in the long run.
> 
> for f in /dev/sda[1567]

This only works for single character things, and when what you're
trying to expand is in the filesystem.

Try this in sh:

	cp verylongfilename{,.orig}

or:

	for i in {a,b,c,d,e}; do
	    for j in {0,1,2,3,4}; do
		echo $i-$j
	    done
	done

Of course this is a silly example, but I've used things like this
before usefully. OTOH, I agree that avoiding such things is
generally a good idea (esp. in scripts where saving a couple of
keystrokes isn't that important), however for interactive work
it's a pretty nifty feature.


Paul Slootman
-- 
home:       paul@wurtel.demon.nl http://www.wurtel.demon.nl/
work:       paul@murphy.nl       http://www.murphy.nl/
debian:     paul@debian.org      http://www.debian.org/
isdn4linux: paul@isdn4linux.org  http://www.isdn4linux.org/



Reply to: