Created
September 29, 2015 06:37
-
-
Save umi-uyura/35d959a166c081d9ec68 to your computer and use it in GitHub Desktop.
List of iOS simulator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DEVICE_PLIST=$(find ~/Library/Developer/CoreSimulator/Devices/ -name device.plist) | |
device_list=($DEVICE_PLIST) | |
devices=() | |
for i in "${device_list[@]}" | |
do | |
udid=$(/usr/libexec/PlistBuddy -c "Print UDID" ${i}) | |
device=$(/usr/libexec/PlistBuddy -c "Print name" ${i} | sed "s/ /-/g") | |
runtime=$(/usr/libexec/PlistBuddy -c "Print runtime" ${i} | cut -d . -f5 | cut -d - -f2- | sed "s/-/./g") | |
sim="$udid,$device,$runtime" | |
devices+=("$sim\n") | |
done | |
array=$(echo ${devices[@]} | sort -t , -k 3,3 -k 2,2 -b) | |
device_array=($array) | |
pv="" | |
for i in ${device_array[@]} | |
do | |
v=$(echo $i | cut -d , -f 3) | |
if [ "$v" != "$pv" ]; then | |
# echo "iOS $v" | |
pv=$v | |
fi | |
udid2=$(echo $i | cut -d , -f1) | |
device2=$(echo $i | cut -d , -f2 | sed "s/-/ /g") | |
runtime2=$(echo $i | cut -d , -f3) | |
# echo "$udid2 ($device2)" | |
echo "$udid2 ($device2, iOS $runtime2)" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment