[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-API] [xs-devel] "Eject ISO Image" Mechanism Proposal



On 08/01/2014 10:10, Andrew Cooper wrote:
> On 07/01/2014 23:41, Jesse Benedict wrote:
--snip--
>> *EXAMPLE CODE*
>>
>> An example is a file I wrote, xe-eject-all-isos (using Bash for
>> simplicity):
>>
>> #!/bin/bash
>>
>> echo "CHECKING"
>>
>> # Get list of VMs from xe vm-list -- specifically UUID
>>
>> VMLIST=`xe vm-list is-control-domain=false | grep uuid | awk '{print $5}'`
>>
>
> VMLIST=$(xe vm-list is-control-domain=false params=uuid --minimal | tr
> ',' ' ')
>
> should do that without grep or awk, (but sadly still using tr)
>
> (Note for Ring3: It would be lovely for shell scripts to get a
> space-delimited list from --minimal rather than comma-delimited, but I
> cant see a convenient option for that)

You can avoid the tr by inviting bash to treat the comma character as the 
delimiter:

VMLIST=$(xe vm-list is-control-domain=false params=uuid --minimal)
IFS=,
for VMUUID in $VMLIST; do ... done

Jonathan

_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.