[LTP] [PATCH ltp 2/6] io/stress_floppy/stress_floppy: Fix shellcheck issue SC2069

Yixin Zhang yixin.zhang@intel.com
Fri Apr 20 05:18:51 CEST 2018


error: The order of the 2>&1 and the redirect matters. The 2>&1 has to
be last. [SC2069]

Signed-off-by: Yixin Zhang <yixin.zhang@intel.com>
---
 testcases/kernel/io/stress_floppy/stress_floppy | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/io/stress_floppy/stress_floppy b/testcases/kernel/io/stress_floppy/stress_floppy
index b269f5ffe..ff327dffb 100755
--- a/testcases/kernel/io/stress_floppy/stress_floppy
+++ b/testcases/kernel/io/stress_floppy/stress_floppy
@@ -96,7 +96,7 @@ test_tar()
 		else
 			tst_resm TINFO "$the_file Tar read passed."
 		fi
-		diff $TCdat/dumpdir/$the_file $the_file 2>&1 >/dev/null
+		diff $TCdat/dumpdir/$the_file $the_file >/dev/null 2>&1
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL "Diff of the $the_file tar files failed!"
 			return
@@ -140,7 +140,7 @@ test_dump()
 
 	for the_file in 1K_file 10K_file 100K_file
 	do
-		diff dumpdir/$the_file /$TCdat/dumpdir/$the_file 2>&1 >/dev/null
+		diff dumpdir/$the_file /$TCdat/dumpdir/$the_file >/dev/null 2>&1
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL \
 				 "Diff of the $the_file backup files failed!"
@@ -180,7 +180,7 @@ test_cpio()
 		else
 			tst_resm TINFO "$the_file cpio read passed."
 		fi
-		diff $TCdat/dumpdir/$the_file $the_file 2>&1 >/dev/null
+		diff $TCdat/dumpdir/$the_file $the_file >/dev/null 2>&1
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL \
 				 "Diff of the $the_file cpio files failed!"
@@ -213,7 +213,7 @@ test_dd()
 		else
 			tst_resm TINFO "$the_file dd read passed."
 		fi
-		diff $TCdat/$the_file $the_file 2>&1 >/dev/null
+		diff $TCdat/$the_file $the_file >/dev/null 2>&1
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL "Diff of the $the_file dd files failed!"
 			return
-- 
2.14.1



More information about the ltp mailing list