Skip to content

Commit

Permalink
t6000lib: re-fix tr portability
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Mar 15, 2008
1 parent 462f8ca commit aab0abf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions t/t6000lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ check_output()
# from front and back.
name_from_description()
{
tr "'" '-' |
tr '~`!@#$%^&*()_+={}[]|\;:"<>,/? ' \
'------------------------------' |
tr -s '-' | tr '[A-Z]' '[a-z]' | sed "s/^-*//;s/-*\$//"
perl -pe '
s/[^A-Za-z0-9.]/-/g;
s/-+/-/g;
s/-$//;
s/^-//;
y/A-Z/a-z/;
'
}


Expand Down

0 comments on commit aab0abf

Please sign in to comment.