Skip to content

Instantly share code, notes, and snippets.

@cattaka
Created December 18, 2018 09:09
Show Gist options
  • Save cattaka/9740a4157a98331fe8f5be338cab497f to your computer and use it in GitHub Desktop.
Save cattaka/9740a4157a98331fe8f5be338cab497f to your computer and use it in GitHub Desktop.
#!/bin/bash
NUM=$1
if [[ ! "$NUM" =~ ^[0-9]+$ ]] || [ "$NUM" -le 0 ]; then
echo "Usage: launch-emurators.sh <num>"
exit
fi
EMULATOR_PIDS=""
shift 1
for i in $(seq 1 $NUM);do
$ANDROID_HOME/emulator/emulator -avd Nexus_5X_API_27 -read-only $@ &
EMULATOR_PIDS="$! $EMULATOR_PIDS"
done
echo $EMULATOR_PIDS
trap 'echo "killing $EMULATOR_PIDS";kill $EMULATOR_PIDS;' INT
wait -n "$EMULATOR_PIDS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment