How to dynamically get the UID of the IOS simulator device and then install it in that device. I currently have this BASH script which does the job, however, when I run that code on a different machine, I need to manually change the ID every time which makes the automation difficult. How can I get the UID just by defining the device type such as IPHONE.8 get the ID and use that instead
#!/bin/bash
export PATH=/usr/local/bin:$PATH
# define variables
DESTINATION="platform=iOS Simulator,name=iPhone 8,OS=13.4.1"
IPHONE_VERSION_ONE="iPhone-7"
APPDIR="$HOME/Library/Developer/Xcode/DerivedData/"
APP_NAME="In-House-iphonesimulator/test.app"
PHONE_ID_ONE="AB877AA-2178-4C29-BF4F-556456C"
xcrun simctl install $PHONE_ID_ONE $APP_LOCATION || { echo 'Unable to install App to Iphone7' ; exit 1; }
Also i put the below answer in the variable, however how to put quotes when store it in a variable?
PHONE_ID="instruments -s devices | grep -m 1 "iPhone 8" | awk -F'[][]' '{print $2}'"