my @bashism_regexs = ( 'function \w+\(\s*\)', # function is useless # should be '.', not 'source' '(?:^|\s+)source\s+(?:\.\/|\/|\$)[^\s]+', '(\[|test|-o|-a)\s*[^\s]+\s+==\s', # should be 'b = a' '\s\|\&', # pipelining is not POSIX '\$\[\w+\]', # arith not allowed '\$\{\w+\:\d+(?::\d+)?\}', # ${foo:3[:1]} '\$\{\w+(/.+?){1,2}\}', # ${parm/?/pat[/str]} '[^\\\]\{([^\s]+?,)+[^\\\}\s]+\}', # brace expansion '(?:^|\s+)\w+\[\d+\]=', # bash arrays, H[0] '[EMAIL PROTECTED]', # bash arrays, ${name[0|*|@]} '(?:^|\s+)(read\s*(?:;|$))' # read without variable );
This is the array of regexes I test Debian scripts against in lintian. it is not all encompassing but it catches most of the egregious ones that bash allows and which the manpage does not clearly define as bash extras.