[plug] Bash script help

raven at themaw.net raven at themaw.net
Mon May 3 20:20:49 WST 2004


On Mon, 3 May 2004, Brad Campbell wrote:

> G'day all,
> 
> This is really simple I'm sure..
> 
> I can do this...
> 
> brad at srv:~$ for i in /dev/sda[1-9] ; do echo $i ; done
> /dev/sda1
> /dev/sda2
> /dev/sda3
> /dev/sda4
> /dev/sda5
> /dev/sda6
> /dev/sda7
> /dev/sda8
> /dev/sda9
> brad at srv:~$
> 
> How do I do it for sda[1-12] ?

One other way is

for i in /dev/sda{[1-9],1[0-2]} ; do echo $i ; done

but the order is probably not what you want.

Ian




More information about the plug mailing list