test-lint: echo -e (or -E) is not portable
Some implementations of `echo` support the '-e' option to enable backslash interpretation of the following string. As an addition, they support '-E' to turn it off. However, none of these are portable, POSIX doesn't even mention them, and many implementations don't support them. A check for '-n' is already done in check-non-portable-shell.pl, extend it to cover '-n', '-e' or '-E'. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Torsten Bögershausen committed
Sep 17, 2017 at 07:43 UTC
1a6d46895d30459efe2d258c6e0a208f00f2b043
1 file changed
+1
-1
t/check-non-portable-shell.pl
+1
-1
@@ -17,7 +17,7 @@ sub err {
17
while (<>) {
18
chomp;
19
/\bsed\s+-i/ and err 'sed -i is not portable';
20
- /\becho\s+-n/ and err 'echo -n is not portable (please use printf)';
20
+ /\becho\s+-[neE]/ and err 'echo with option is not portable (please use printf)';
21
/^\s*declare\s+/ and err 'arrays/declare not portable';
22
/^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)';
23
/\btest\s+[^=]*==/ and err '"test a == b" is not portable (please use =)';