> > +             '(test|\[) .+-[ao]',         # test/[ -a/-o binary operators
> 
> (test|\[).+\s-[ao]\s perhaps?

(test|\[)\s+.+\s-[ao]\s might be less dangerous.

> This has still the problem of mathing stuff in " " but we can probably
> ignore that.

You mean like
bash -c "test $blah -o $blah" ?

> > +             'kill\s+-[^s]',              # kill -[0-9] or -[A-Z]
> 
> I would suggest either kill\s+-[^sl] or kill\s+-[0-9A-Z]

I like the former.

> 
> > +             'trap\s+".*"\s+.*[1-9]',     # trap with signal numbers
> 
> hmm, perhaps better trap\s+["']?.*["']?\s+[1-9]

This is better, but it will miss

trap "echo hi" EXIT HUP 3

> local\s
> 
> > +             'command\s+-v',              # UPism
> > +             'type .+',                   # XSIism
> 
> type\s+.+ just to be consitent

May be useful to avoid flagging single words such as "local" or "type"
if they're being echo'd, printf'd, or cat'd.

> And we need an common RE before the commands to try to guess if they are
> really commands.

I don't know how you'd do that.

Reply via email to