Hello,

this patch fixes some minor bugs in the code of LTP shell scripts.

 - quote arguments of test(1) in some places concerning redhat
   detection

 - don't execute the result of type(1), it makes no sense - even more when the 
output of it should be redirected

Regards
    Jiri Palecek

Signed-off-by: Jiri Palecek <[email protected]>
---
 testcases/commands/ade/file/file_test.sh  |    2 +-
 testcases/commands/cron/cron_allow01      |    2 +-
 testcases/commands/cron/cron_deny01       |    2 +-
 testcases/commands/cron/cron_pos_tests.sh |    2 +-
 testcases/commands/mail/mail_tests.sh     |    2 +-
 testcases/commands/su/su01                |    6 +++---
 testcases/network/tcp_cmds/rdist/rdist01  |    2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/testcases/commands/ade/file/file_test.sh 
b/testcases/commands/ade/file/file_test.sh
index e5de1ed..652b441 100755
--- a/testcases/commands/ade/file/file_test.sh
+++ b/testcases/commands/ade/file/file_test.sh
@@ -474,7 +474,7 @@ export TCID=file09
 export TST_COUNT=9
 
 $LTPBIN/tst_resm TINFO "TEST #9: file command recognizes RPM files"
-`type rpm &> /dev/null`
+type rpm > /dev/null 2>&1
 if [ $? = 0 ]; then
 bDIR=$(rpm --eval "%{_topdir}")
 bCMD=rpmbuild
diff --git a/testcases/commands/cron/cron_allow01 
b/testcases/commands/cron/cron_allow01
index 404ca28..9a941dd 100755
--- a/testcases/commands/cron/cron_allow01
+++ b/testcases/commands/cron/cron_allow01
@@ -29,7 +29,7 @@ iam=`whoami`
 tvar=${MACHTYPE%-*}
 tvar=${tvar#*-}
 
-if [ $tvar = "redhat" -o $tvar = "redhat-linux" ] 
+if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] 
 then
 CRON_ALLOW="/etc/cron.allow"
 else
diff --git a/testcases/commands/cron/cron_deny01 
b/testcases/commands/cron/cron_deny01
index 563f857..89ca66c 100755
--- a/testcases/commands/cron/cron_deny01
+++ b/testcases/commands/cron/cron_deny01
@@ -29,7 +29,7 @@ iam=`whoami`
 tvar=${MACHTYPE%-*}
 tvar=${tvar#*-}
 
-if [ $tvar = "redhat" -o $tvar = "redhat-linux" ] 
+if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] 
 then
 CRON_DENY="/etc/cron.deny"
 CRON_ALLOW="/etc/cron.allow"
diff --git a/testcases/commands/cron/cron_pos_tests.sh 
b/testcases/commands/cron/cron_pos_tests.sh
index 9b5c9f7..acc08cb 100755
--- a/testcases/commands/cron/cron_pos_tests.sh
+++ b/testcases/commands/cron/cron_pos_tests.sh
@@ -7,7 +7,7 @@ iam=`whoami`
 tvar=${MACHTYPE%-*}
 tvar=${tvar#*-}
 
-if [ $tvar = "redhat" -o $tvar = "redhat-linux" ] 
+if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] 
 then
        CRON_ALLOW="/etc/cron.allow"
 else
diff --git a/testcases/commands/mail/mail_tests.sh 
b/testcases/commands/mail/mail_tests.sh
index 45bac93..cee08d6 100755
--- a/testcases/commands/mail/mail_tests.sh
+++ b/testcases/commands/mail/mail_tests.sh
@@ -60,7 +60,7 @@ export TCID=SETUP
 export TST_COUNT=1
 
 MAIL_NOT_INSTALLED=
-`type mail &> /dev/null`
+type mail > /dev/null 2>&1
 if [ $? != 0 ]; then
     MAIL_NOT_INSTALLED=1
 fi
diff --git a/testcases/commands/su/su01 b/testcases/commands/su/su01
index 91548c7..1228c01 100755
--- a/testcases/commands/su/su01
+++ b/testcases/commands/su/su01
@@ -43,7 +43,7 @@ tvar=${tvar#*-}
 export tvar
 printf "Machine type is: $tvar\n\n"
 
-if [ $tvar = "redhat" -o $tvar = "redhat-linux" ] 
+if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ] 
 # Need to also set group for TEST_USER2
 then
 export TEST_USER1_GROUP="wheel"
@@ -99,7 +99,7 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
 
        #create users home directory (SLES 8 does not do this, even when 
specified in adduser)
 # Only do this if not RH; RH creates the directory.
-       if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]
+       if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ]
        then {
           USER_UID=`id -u $TEST_USER1`
           USER_GID=`id -g $TEST_USER1`
@@ -135,7 +135,7 @@ rm -f $TEST_ENV_FILE > /dev/null 2>&1
        
        #create users home diretory (SLES 8 does not do this, even when 
specified in adduser)
 # Only do this if not RH; RH creates the directory.
-        if [ $tvar != "redhat" -a $tvar != "redhat-linux" ]
+        if [ "$tvar" != "redhat" -a "$tvar" != "redhat-linux" ]
         then {
           USER_UID=`id -u $TEST_USER2`
           USER_GID=`id -g $TEST_USER2`
diff --git a/testcases/network/tcp_cmds/rdist/rdist01 
b/testcases/network/tcp_cmds/rdist/rdist01
index 624fd12..d03dd73 100755
--- a/testcases/network/tcp_cmds/rdist/rdist01
+++ b/testcases/network/tcp_cmds/rdist/rdist01
@@ -175,7 +175,7 @@ check_result()
                x=\$(( \$x + \$i ))
             done
             echo \$x`
-         if [ $TOTAL_SUM = $LSUM ]; then 
+         if [ "$TOTAL_SUM" = "$LSUM" ]; then 
             tst_resm TINFO "Success rdist in $c_ru...@$c_rhost "
            rsh -n -l $c_ruser $c_rhost "rm -rf $FILES $DIRECTORIES"
          else
-- 
1.6.4.3




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to