#!/bin/bash DEVICES_LIST="$(adb devices -l)" echo "${DEVICES_LIST}" filter_out() { local -n dev_string=${1} [[ ${dev_string} =~ List* ]] && dev_string="" return 0 } echo "${DEVICES_LIST}" | while IFS= read -r DEV; do SERIAL="$(echo "${DEV}" | awk '{print $1}')" filter_out SERIAL [ -z "${SERIAL}" ] && continue # echo "Device: ${DEV}" # echo "Serial: ${SERIAL}" adb -s "${SERIAL}" shell run-as com.foxx.androidcast ls files/session_stats/ adb -s "${SERIAL}" shell run-as com.foxx.androidcast cat files/session_stats/session_*.json done