1#!/bin/bash 2set -e -o pipefail 3 4# Copy a file or directory to the target Android device. 5# 6# Usage: target_cp <src> <target>:<dest> 7 8src="$1" 9shift 10 11targetdest="$1" 12shift 13 14target="${targetdest%:*}" 15dest="${targetdest#*:}" 16 17if [[ -z "${src}" || -z "${target}" || -z "${dest}" || "${targetdest}" != "${target}:${dest}" || -n "$*" ]] 18then 19 echo "Usage: target_cp <src> <target>:<dest>" 20 exit 1 21fi 22 23if [[ -d ${src} ]] 24then 25 adb_${target} push ${src} ${dest}/${src##*/} 2>/dev/null 26else 27 adb_${target} push ${src} ${dest} 2>/dev/null 28fi 29