-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make a clear deference between adb shell fail and adb error
- Loading branch information
Showing
2 changed files
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
$STARTUP = "/sdcard/.adb/startup.sh" | ||
adb shell "[ -f $STARTUP ]" ; | ||
if (-not $?){ # $?: command success status (true if the last command was successful) | ||
adb shell "[ -f $STARTUP ] || exit 6" ; | ||
if ($LastExitCode -eq 6){ # $?: command success status (true if the last command was successful) | ||
Write-Output "file not found, push with adb" | ||
adb push "$PSScriptRoot/startup.sh" $STARTUP | ||
} | ||
if ($LastExitCode -eq 1){ # adb error | ||
exit 1 | ||
} | ||
adb shell -t "HOME='/sdcard' ENV='$STARTUP' sh -i -o emacs -o vi-tabcomplete" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
#! /bin/bash | ||
STARTUP=/sdcard/.adb/startup.sh | ||
if ! adb shell "[ -f $STARTUP ]" ; then | ||
adb shell "[ -f $STARTUP ] || exit 6"; | ||
last_exit_status=$? | ||
|
||
if [ $last_exit_status -eq 6 ] ; then | ||
echo "file not found, push with adb" | ||
adb push "$(dirname "$0")/startup.sh" $STARTUP | ||
|
||
elif [ $last_exit_status -eq 1 ]; then # adb error | ||
exit 1 | ||
fi | ||
# for most shells, '-o emacs -o vi-tabcomplete' is the default, but for some it isn't. | ||
adb shell -t "HOME='/sdcard' ENV='$STARTUP' sh -i -o emacs -o vi-tabcomplete" |