t6000lib: re-fix tr portability
It seems that some implementations of tr don't like a replacement string of '-----...'; they try to find the double-dash option "---...". Instead of this pipeline of tr and sed invocations, just use a single perl invocation. Signed-off-by: Jeff King <peff@peff.net>
Jeff King committed
Mar 14, 2008 at 20:32 UTC
aab0abf7ef2c7636e3b37d4a939ae68784b08e06
1 file changed
+7
-4
t/t6000lib.sh
+7
-4
@@ -97,10 +97,13 @@ check_output()
97
# from front and back.
98
name_from_description()
99
{
100
- tr "'" '-' |
101
- tr '~`!@#$%^&*()_+={}[]|\;:"<>,/? ' \
102
- '------------------------------' |
103
- tr -s '-' | tr '[A-Z]' '[a-z]' | sed "s/^-*//;s/-*\$//"
100
+ perl -pe '
101
+ s/[^A-Za-z0-9.]/-/g;
102
+ s/-+/-/g;
103
+ s/-$//;
104
+ s/^-//;
105
+ y/A-Z/a-z/;
106
+ '
107
}
108
109