From 4e1667fa29c13359241eef6aeb9f38fe3668ad6c Mon Sep 17 00:00:00 2001 From: Aaron Ball Date: Thu, 18 May 2017 21:04:53 -0600 Subject: Fixed grep switches Stock grep on android does not support long switches (like --only-matching vs -o, or --quiet vs -q, etc). This replaces all long grep arguments with their short equivelants. --- andbackup.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/andbackup.sh b/andbackup.sh index 646c0ce..70e3552 100755 --- a/andbackup.sh +++ b/andbackup.sh @@ -89,13 +89,13 @@ backup_app() { #If app has the flag_delimiter that means options are passed in local preserveCache=false - if [[ 0 = $(echo ${app} | grep --quiet [${flag_delimiter}]; echo $?) ]]; then + if [[ 0 = $(echo ${app} | grep -q [${flag_delimiter}]; echo $?) ]]; then linfo "This app $app has passed in options" - if [[ 0 = $(echo ${app} | grep --quiet "preserveCache"; echo $?) ]]; then + if [[ 0 = $(echo ${app} | grep -q "preserveCache"; echo $?) ]]; then preserveCache=true fi #Need to get app back to std naming (without params) - app=`echo ${app} | grep --only-matching ^.*- | sed s/-//g | cat -` + app=`echo ${app} | grep -o ^.*- | sed s/-//g | cat -` fi # Make sure app is installed @@ -161,10 +161,10 @@ restore_app() { fi # When restoring something with flags need to restore app alone - if [[ 0 = $(echo ${app} | grep --quiet [${flag_delimiter}]; echo $?) ]]; then + if [[ 0 = $(echo ${app} | grep -q [${flag_delimiter}]; echo $?) ]]; then linfo "This app $app had passed in options" #Need to get app back to std naming (without params) - app=`echo ${app} | grep --only-matching ^.*- | sed s/-//g | cat -` + app=`echo ${app} | grep -o ^.*- | sed s/-//g | cat -` linfo "Restoring to std name \"${app}\" while we restore" fi -- cgit v1.2.3