From c38e0303cd79072ddc4ecf60b59f1916f053c7d6 Mon Sep 17 00:00:00 2001 From: Steven Penny Date: Wed, 14 May 2014 21:20:39 -0500 Subject: [PATCH] Minor cleanup - test commands directly instead of using temporary variable - test command directly instead of exit variable --- apt-cyg | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/apt-cyg b/apt-cyg index 4185caf..b3652d3 100755 --- a/apt-cyg +++ b/apt-cyg @@ -322,8 +322,7 @@ case "$command" in for pkg in $packages do - already=$(grep -c "^$pkg " /etc/setup/installed.db) - if (( already )) + if grep -q "^$pkg " /etc/setup/installed.db then echo Package $pkg is already installed, skipping continue @@ -412,14 +411,12 @@ case "$command" in echo $requires for package in $requires do - already=`grep -c "^$package " /etc/setup/installed.db` - if (( already )) + if grep -q "^$package " /etc/setup/installed.db then echo Package $package is already installed, skipping continue fi - apt-cyg install $package - (( $? && warn++ )) + apt-cyg install $package || (( warn++ )) done fi if (( warn )) @@ -445,8 +442,7 @@ case "$command" in for pkg in $packages do - already=$(grep -c "^$pkg " /etc/setup/installed.db) - if (( ! already )) + if ! grep -q "^$pkg " /etc/setup/installed.db then echo Package $pkg is not installed, skipping continue