Suppress some bash redirection error messages
In particular, when testing if the filesystem allows tabs in filenames, bash issues an error something like: ./t4016-diff-quote.sh: pathname with HT: No such file or directory which is caused by the failure of the (stdout) redirection, since the file cannot be created. In order to suppress the error message, you must redirect stderr to /dev/null, *before* the stdout redirection on the command-line. Also, remove a redundant filesystem check from the begining of the t3902-quoted.sh test and standardise the "test skipped" message to 'say' on exit. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramsay Jones committed
Aug 26, 2008 at 18:52 UTC
2b8437321901cf1559527090f5a475f4924031e5
3 files changed
+4
-10
t/t3300-funny-names.sh
+1
-1
@@ -21,7 +21,7 @@ cat >"$p0" <<\EOF
21
3. A quick brown fox jumps over the lazy cat, oops dog.
22
EOF
23
24
-cat >"$p1" "$p0"
24
+cat 2>/dev/null >"$p1" "$p0"
25
echo 'Foo Bar Baz' >"$p2"
26
27
test -f "$p1" && cmp "$p0" "$p1" || {
t/t3902-quoted.sh
+1
-7
@@ -7,12 +7,6 @@ test_description='quoted output'
7
8
. ./test-lib.sh
9
10
-P1='pathname with HT'
11
-: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || {
12
- echo >&2 'Filesystem does not support HT in names'
13
- test_done
14
-}
15
-
10
FN='濱野'
11
GN='純'
12
HT=' '
@@ -20,7 +14,7 @@ LF='
14
'
15
DQ='"'
16
23
-echo foo > "Name and an${HT}HT"
17
+echo foo 2>/dev/null > "Name and an${HT}HT"
18
test -f "Name and an${HT}HT" || {
19
# since FAT/NTFS does not allow tabs in filenames, skip this test
20
say 'Your filesystem does not allow tabs in filenames, test skipped.'
t/t4016-diff-quote.sh
+2
-2
@@ -13,8 +13,8 @@ P1='pathname with HT'
13
P2='pathname with SP'
14
P3='pathname
15
with LF'
16
-: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || {
17
- echo >&2 'Filesystem does not support tabs in names'
16
+: 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || {
17
+ say 'Your filesystem does not allow tabs in filenames, test skipped.'
18
test_done
19
}
20