Re: [PATCH] tests: turn on test-lint-shell-syntax by default
- From
- Matt Kraai <kraai@ftbfs.org>
- Date
- Jan 13, 2013, 16:50 UTC
- Message-ID
- <20130113165037.GA5118@ftbfs.org>
- In-Reply-To
- <50F28BB5.9080607@web.de>
On Sun, Jan 13, 2013 at 11:25:57AM +0100, Torsten Bögershausen wrote:
Show 12 quoted lines
> @@ -16,10 +16,10 @@ sub err {
>
> while (<>) {
> chomp;
> - /^\s*sed\s+-i/ and err 'sed -i is not portable';
> - /^\s*echo\s+-n/ and err 'echo -n is not portable (please use printf)';
> - /^\s*declare\s+/ and err 'arrays/declare not portable';
> - /^\s*[^#]\s*which\s/ and err 'which is not portable (please use type)';
> + /^\s*sed\s+-i\s+\S/ and err 'sed -i is not portable';
> + /^\s*echo\s+-n\s+\S/ and err 'echo -n is not portable (please use printf)';
> + /^\s*declare\s+\S/ and err 'arrays/declare not portable';
> + /^\s*[^#]\s*which\s+[-a-zA-Z0-9]+$/ and err 'which is not portable (please use type)';The "[^#]" appears to ensure that there's at least one character before the which and that it's not a pound sign. Why is this done? Why isn't it done for the other commands?