On 11/09/2012 05:14 PM, Paul Eggert wrote:
On 11/09/2012 01:50 AM, Bernhard Voelker wrote:
What about simplifying the first s/... to eliminate all blanks?

Yes, could do that, if someone has the energy....

I also noticed that `sed -i` was used,
so I fixed that and made the simplificiation as suggested above, with...


commit 6bc77b3ae940b8afff101a1484e8f04d2cba1f56
Author: Pádraig Brady <[email protected]>
Date:   Thu Nov 22 10:07:25 2012 +0000

    tests: don't rely on sed -i being available

    * tests/df/df-output.sh: sed --in-place is not generally available.
    Also as suggested by Bernhard Voelker, simplify one of the
    sed expressions a little, as removing all spaces suffices here.

diff --git a/tests/df/df-output.sh b/tests/df/df-output.sh
index f586334..0aee5f2 100644
--- a/tests/df/df-output.sh
+++ b/tests/df/df-output.sh
@@ -27,28 +27,28 @@ Try 'df --help' for more information.
 EOF

 df -i --output '.' 2>out && fail=1
-sed -i 's/ -i / OPT /' out
-compare exp out || fail=1
+sed 's/ -i / OPT /' out > out2
+compare exp out2 || fail=1

 df --output -i '.' 2>out && fail=1
-sed -i 's/ -i / OPT /' out
-compare exp out || fail=1
+sed 's/ -i / OPT /' out > out2
+compare exp out2 || fail=1

 df -P --output '.' 2>out && fail=1
-sed -i 's/ -P / OPT /' out
-compare exp out || fail=1
+sed 's/ -P / OPT /' out > out2
+compare exp out2 || fail=1

 df --output -P '.' 2>out && fail=1
-sed -i 's/ -P / OPT /' out
-compare exp out || fail=1
+sed 's/ -P / OPT /' out > out2
+compare exp out2 || fail=1

 df -T --output '.' 2>out && fail=1
-sed -i 's/ -T / OPT /' out
-compare exp out || fail=1
+sed 's/ -T / OPT /' out > out2
+compare exp out2 || fail=1

 df --output -T '.' 2>out && fail=1
-sed -i 's/ -T / OPT /' out
-compare exp out || fail=1
+sed 's/ -T / OPT /' out > out2
+compare exp out2 || fail=1

 # Ensure that each field is only used once for the --output argument.
 cat <<\EOF > exp || framework_failure_
@@ -93,8 +93,7 @@ EOF

 df -B1K --output=size '.' >out || fail=1
 sed -e '1 {
-          s/ [ ]*/ /g
-          s/^ //
+          s/ //
           q
         }' out > out2
 compare exp out2 || fail=1

Reply via email to