Bash在执行一个命令而不是执行其余脚本后退出

时间:2019-02-27 13:44:33

标签: shell adb

#!/bin/bash

read -p "Would you like to delete Google Drive? (yes/no) " DRIVE
if [ "$DRIVE" == "yes" ]
then
    echo "Google Drive will be deleted."
    exec adb uninstall --user 0 com.google.android.apps.docs
elif [ "$DRIVE" == "no" ]
then
    echo "Google Drive will not be deleted."
else
    echo "It's a yes or no question!" 
fi

read -p "Would you like to delete Google Duo? (yes/no) " DUO#
if [ "$DUO" == "yes" ]
then
    echo "Google Duo will be deleted."
    exec adb uninstall --user 0 com.google.android.apps.tachyon
elif [ "$DUO" == "no" ]
then
    echo "Google Duo will not be deleted."
else
    echo "It's a yes or no question" 
fi

我的问题是在exec adb卸载--user 0 com.google.android.apps.docs

后退出

1 个答案:

答案 0 :(得分:3)

exec adb uninstall --user 0 com.google.android.apps.docs

execadb替换脚本-它永远不会从exec返回。摆脱它,您不需要它。

adb uninstall --user 0 com.google.android.apps.docs