> for(disk in /dev/sd[0-9A-Zabd-z]*) {
>       if(test -f $disk/data && test -f $disk/ctl)
>               disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
>       if(test -f $disk/plan9)
>               parts=($disk/plan9*)
>       if not
>               parts=($disk/data)
>       for(part in $parts)
>               if(test -f $part)
>                       disk/prep -p $part >$disk/ctl >[2]/dev/null
> }

definately a bug.

there are certainly better solutions to this, but the one that
requires the least code would be something like this

for(disk in /dev/sd?[0-9]) {
        if(test -f $disk/data && test -f $disk/ctl){
                disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
                if(test -f $disk/plan9){
                        for(part in $disk/plan9*)
                                disk/prep -p $part >$disk/ctl >[2]/dev/null
                }
                if not{
                        part=$disk/data
                        if(! disk/prep -p $part>[2=1] | grep -s '^no plan 9')
                                disk/prep -p $part >$disk/ctl >[2]/dev/null
                        parts=($disk/data)
                }
        }
}

- erik


Reply via email to