Bug#464026: [checks/scripts] Sync bashism tests with checkbashisms
On Mon, 2008-02-04 at 16:06 -0800, Russ Allbery wrote:
> "Adam D. Barratt" <adam@adam-barratt.org.uk> writes:
>
> > The first two certainly should be prefixed by something to avoid them
> > matching strings that happen to end in "echo -e". I've updated
> > checkbashisms to do so for all three.
> >
> > As far as I can see that won't stop "echo echo -e" matching, however.
>
> I was proposing using:
>
> '(?:^|\s+)echo\s+-e', # echo -e
> '(?:^|\s+)exec\s+-[acl]', # exec -c/-l/-a name
> '(?:^|\s+)let\s', # let ...
That's what I've changed checkbashsims to use. Unless I'm missing
something (which I'm more than happy to have pointed out :) "echo echo
-e" matches "\s+echo\s+-e" as the expression isn't (in that case)
anchored to the start of the line.
Specifically:
adam@kaa:~/debian/packages/devscripts/svn/trunk$ cat echo.sh
#!/bin/sh
echo echo -e
adam@kaa:~/debian/packages/devscripts/svn/trunk$ scripts/checkbashisms.pl echo.sh
possible bashism in echo.sh line 3 (echo -e):
echo echo -e
Adam
Reply to: