|
From: | Pádraig Brady |
Subject: | Re: [PATCH] df: port the new df test to POSIX sed, larger file systems |
Date: | Fri, 09 Nov 2012 09:56:39 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 |
On 11/09/2012 09:50 AM, Bernhard Voelker wrote:
On 11/09/2012 10:13 AM, Paul Eggert wrote:* tests/df/df-output.sh: For the test "df -B1K --output=size", do not assume that the file system size fits in 9 bytes; it might be larger than that, so omit leading space. Also, use portable 'sed' commands: POSIX says sed commands inside { } should all end in newline.Good catch, thanks. My file system for '.' is too small for this test to fail ... ;-)
Yes thanks for the fix Paul.
-sed -e '1 {s/ [ ]*/ /g;q}' out > out2 +sed -e '1 { + s/ [ ]*/ /g + s/^ // + q + }' out > out2What about simplifying the first s/... to eliminate all blanks? -sed -e '1 {s/ [ ]*/ /g;q}' out > out2 +sed -e '1 { + s/ //g + q + }' out > out2
I suppose you could simplify them all to a single line again by using coreutils head, tail and tr instead of sed? replace sed 1 ... with: head -n1 | tr -s ' ' and sed 3... with: tail -n1 | tr -s ' ' and the right aligned df -B1K one with: head -n1 | tr -d ' ' cheers, Pádraig.
[Prev in Thread] | Current Thread | [Next in Thread] |