The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > AIX
.
google unix.com



AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Should I write a PERL Script or Shell Script? mojoman UNIX for Dummies Questions & Answers 2 11-11-2008 03:54 PM
how to write script in tar naveeng.81 Shell Programming and Scripting 1 04-18-2008 12:04 PM
Please write this script for me nadman123 Shell Programming and Scripting 1 04-08-2008 10:30 PM
How to write script for this ? me_haroon AIX 0 07-01-2006 06:30 AM
Help! Need to write my first script fundidor Shell Programming and Scripting 5 01-08-2004 10:20 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-03-2009
rainbow_bean rainbow_bean is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 82
how to write this script?

If I need delete some disk,

Code:
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?

Last edited by vgersh99; 09-03-2009 at 10:49 AM.. Reason: code tags, PLEASE!
  #2 (permalink)  
Old 09-03-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
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 [code] and [/code] 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.
Code:
#!/bin/ksh
while read disk
do
  rmdev -dl "${disk}"
done < /path/to/myDisk.txt

Last edited by vgersh99; 09-03-2009 at 12:26 PM.. Reason: forgot 'do' - fixed
  #3 (permalink)  
Old 09-03-2009
rainbow_bean rainbow_bean is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 82
Thank you,

However, it shows this error:

0403-057 Syntax error at line 4 : `done' is not expected.
  #4 (permalink)  
Old 09-03-2009
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,575
because vgersh99 just forgot the "do" before the rmdev instruction...
  #5 (permalink)  
Old 09-03-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
Quote:
Originally Posted by vbe View Post
because vgersh99 just forgot the "do" before the rmdev instruction...
ooops - thanks vbe - fixed the post.
  #6 (permalink)  
Old 09-03-2009
rainbow_bean rainbow_bean is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 82
Thank you all!
  #7 (permalink)  
Old 09-03-2009
zxmaus's Avatar
zxmaus zxmaus is offline Forum Staff  
Moderator
  
 

Join Date: May 2008
Location: /etc/objrepos
Posts: 301
Since I assume you dont want to remove your rootvg disks, try

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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0