From 6c67c521798a9a6da67f4b8dfbae8fe03f649763 Mon Sep 17 00:00:00 2001 From: Philippe Bordron Date: Wed, 4 Oct 2017 10:27:53 +0200 Subject: [PATCH 1/2] Make compatible with some old bash interpreters Correct the `tldr: line 319: -1: substring expression < 0` error on some system with old bash. --- tldr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tldr b/tldr index 3c3f5cb..7037474 100755 --- a/tldr +++ b/tldr @@ -316,7 +316,7 @@ Display_tldr(){ '`') ((newfmt)) && Unlinted "Bad first character" ((${#REPLY} <= 2)) && Unlinted "No valid code content" [[ ! ${REPLY: -1} = '`' ]] && Unlinted "Code doesn't end in backtick" - val=${REPLY:1:-1} + val=${REPLY:1:${#REPLY}-1} # Value: convert {{value}} val=${val//\{\{/$CX$V} val=${val//\}\}/$XV$C} From 198906580a7bf7d00e7e79f0bfe52da03f4ff6a7 Mon Sep 17 00:00:00 2001 From: Philippe Bordron Date: Wed, 4 Oct 2017 10:29:38 +0200 Subject: [PATCH 2/2] Update tldr --- tldr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tldr b/tldr index 7037474..c3fd4a8 100755 --- a/tldr +++ b/tldr @@ -316,7 +316,7 @@ Display_tldr(){ '`') ((newfmt)) && Unlinted "Bad first character" ((${#REPLY} <= 2)) && Unlinted "No valid code content" [[ ! ${REPLY: -1} = '`' ]] && Unlinted "Code doesn't end in backtick" - val=${REPLY:1:${#REPLY}-1} + val=${REPLY:1:${#REPLY}-2} # Value: convert {{value}} val=${val//\{\{/$CX$V} val=${val//\}\}/$XV$C}