If I find in vg2 then I can verify the VG free space and then I can compute how much space I can add.
Is there someone already have a script for this?
If I were thinking of scripting this, I think it's a little difficult because I need to do this "lsvg > listvg" and from that, I need to loop on the file listvg. I can do that but I know someone might have a trick on this with simple bash/korn shell scripting without file reading.
I'm not sure I totally understand what you're trying to do, but have you ever tried using smit ?
smit stands for System Management Interface Tool. Unless I'm mistaken, it's an IBM product that ships with AIX. I.E. Only AIX has it. It provides a simple menu structure to a lot of the seldom used system management stuff.
A neat thing about it is, it creates a log of the actual commands used to do what you've asked it to do. Therefore, you could actually look at THAT and create a script if there's something complicated you do often.
While not too complicated, that's how I created a script to add users.