how to write this script?

If I need delete some disk,

for i in hdisk1 hdisk2 hdisk3 hdisk4
do 
rmdev -dl $i
done

if I have more than 100 hdisks, how to write a script like that to delete them?

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

---------- Post updated at 10:51 AM ---------- Previous update was at 10:49 AM ----------

create a file myDisks.txt with one disk name per line.

#!/bin/ksh
while read disk
do
  rmdev -dl "${disk}"
done < /path/to/myDisk.txt

Thank you,

However, it shows this error:

0403-057 Syntax error at line 4 : `done' is not expected.

because vgersh99 just forgot the "do" before the rmdev instruction...

ooops - thanks vbe - fixed the post.

Thank you all!

Since I assume you dont want to remove your rootvg disks, try

for i in $(lspv| awk '!/rootvg/ {print $1}') ; do rmdev -dl $i ; done

Rgds
zxmaus