Script for VMWare ESX

Hi

I would make a script for my ESX server. Unfortunately I'm beginner in shell scripting.

I will do the following:
# With the command vmware-cmd -l I can do a listing like this
File1.vmx
File2.vmx
File3.vmx
File4.vmx
File5.vmx

# Now with every single line of this output I will execute the following
# vmware-cmd <output line 1> create
# Example:

vmware-cmd File1.vmx create

Could you please help me with this script.

Best regards,

Hi,

Create a file with your output

vmware-cmd -l > /path/outputfile

Then use the below code.

#!/bin/sh

while read OUTPUT_LINE
do

vmware-cmd $OUTPUT_LINE create

done < /path/outputfile

Or alternatively:

vmware-cmd -l | xargs -I{} vmware-cmd {} create