-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathcommands.sh
executable file
·34 lines (29 loc) · 941 Bytes
/
commands.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Created by Sujay Davalgi
#
# Pass the commands to adb / fastboot
#
# Usage: ./commands.sh [<Device Serial>]
# Command line Arguments (Optional):
# $1 - Input the device serial
# If the serial number is not provided, it will display the list of attached devices to pick from
. ./library/mainFunctions.sh
. ./library/textFormatting.sh
. ./library/deviceOperations.sh
if [ $# -lt 1 ]; then
echo -e -n "Enter the command : "
read commands
else
commands="$@"
fi
getDeviceChoice
displaySelectedDevice $deviceSerial
if [ "$( isAdbDevice $deviceSerial )" == "true" ]; then
echo " Device is in 'adb' mode"
`adb -s $deviceSerial wait-for-device ${commands}`
elif [[ "$( isFastbootDevice $deviceSerial )" == "true" || "$( isRecoveryDevice $deviceSerial )" == "true" ]]; then
echo " Device is in 'fastboot' mode"
`fastboot -s $deviceSerial ${commands}`
else
echo " Device is not in 'adb' mode or 'fastboot' mode"
fi