In a bash script this command return a normal error (because $L_VM_NAME2 is empty for the test) :
Code: Select all
VBoxManage showvminfo "$L_VM_NAME2" | grep MAC | awk '{print $4}' | cut -d',' -f1
VBoxManage: error: Could not find a registered machine named ''
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(VMNameOrUuid).raw(), machine.asOutParam())" at line 2699 of file VBoxManageInfo.cpp
Code: Select all
VBoxManage showvminfo "$L_VM_NAME2" | grep MAC | awk '{print $4}' | cut -d',' -f1
L_RET_CODE1="${PIPESTATUS[0]}"
echo "L_RET_CODE1 : $L_RET_CODE1"
VBoxManage: error: Could not find a registered machine named ''
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(VMNameOrUuid).raw(), machine.asOutParam())" at line 2699 of file VBoxManageInfo.cpp
L_RET_CODE1 : 1Code: Select all
L_VM_MAC_ADDR_VALUE1=$(VBoxManage showvminfo "$L_VM_NAME2" | grep MAC | awk '{print $4}' | cut -d',' -f1)
L_RET_CODE2="${PIPESTATUS[0]}"
echo "L_RET_CODE2 : $L_RET_CODE2"
echo "L_VM_MAC_ADDR_VALUE1 : $L_VM_MAC_ADDR_VALUE1"
Code: Select all
VBoxManage: error: Could not find a registered machine named ''
VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "FindMachine(Bstr(VMNameOrUuid).raw(), machine.asOutParam())" at line 2699 of file VBoxManageInfo.cpp
L_RET_CODE2 : 0
L_VM_MAC_ADDR_VALUE1 :
Any comment is welcome.