#!/bin/bash -x | |
# Utilities to interact with android more easily | |
make_csv() { | |
out="" | |
in=$1 | |
for p in $in; do | |
if [ "x$out" == "x" ]; then | |
out=$p | |
else | |
out="$out,$p" | |
fi | |
done | |
echo $out | |
} | |
make_spaces() { | |
out="" | |
in=$1 | |
for p in $in; do | |
if [ "x$out" == "x" ]; then | |
out=$p | |
else | |
out="$out $p" | |
fi | |
done | |
echo $out | |
} | |
cmd_exists() { | |
which $1 > /dev/null | |
return $? | |
} | |
do_adb_root() { | |
adb root > /dev/null 2>&1 | |
return $? | |
} | |
die() { | |
exit_code=$1 | |
msg=$2 | |
echo "ERROR: $msg" | |
exit $exit_code | |
} |