LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   trying to get output of a vmware command passed to another vmware command (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/trying-to-get-output-of-a-vmware-command-passed-to-another-vmware-command-4175606981/)

bbraml 05-30-2017 11:16 AM

trying to get output of a vmware command passed to another vmware command
 
I kickstarted an esxi server, enabled ssh and connected to it. using the command, esxcfg-mpath -l to list all the drives, I need to capture the first drive listed. So I have this command:
Code:

esxcfg-mpath -l | grep 'Device:' | head -1 | awk '{print $2}'
This gives me the proper output, which is the name of the needed drive. I need to pass this to my next command:
Code:

vmfkstools -r /vmfs/devices/disks/that_output_from_awk /vmfs/volumes/datastore1/vm1/disk.vmdk
I am running into a roadblock on how to get that done.

hydrurga 05-30-2017 12:45 PM

Quote:

Originally Posted by bbraml (Post 5717019)
I kickstarted an esxi server, enabled ssh and connected to it. using the command, esxcfg-mpath -l to list all the drives, I need to capture the first drive listed. So I have this command:
Code:

esxcfg-mpath -l | grep 'Device:' | head -1 | awk '{print $2}'
This gives me the proper output, which is the name of the needed drive. I need to pass this to my next command:
Code:

vmfkstools -r /vmfs/devices/disks/that_output_from_awk /vmfs/volumes/datastore1/vm1/disk.vmdk
I am running into a roadblock on how to get that done.

Assign a bash variable to the output from the first command.

Insert that variable in the filepath in the second command.


All times are GMT -5. The time now is 05:13 AM.