[plug] Bash script help

Bernard Blackham bernard at blackham.com.au
Mon May 3 19:03:20 WST 2004


On Mon, May 03, 2004 at 02:56:42PM +0400, Brad Campbell wrote:
> 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
> 
> How do I do it for sda[1-12] ?

Use zsh (: /dev/sda{1..12}

Or more tradionally (under any shell)

for i in `seq -f/dev/sda%g 12` do ; ...

> I have tried brackets, braces, quotes, commas, google.. I'm sure I'm 
> missing something really really silly.

I don't believe bash can do it natively.

HTH,

Bernard.

-- 
 Bernard Blackham <bernard at blackham dot com dot au>



More information about the plug mailing list