The following commit has been merged in the master branch:
commit faaeaa14481b2ca09b815d7b2366231f9fca6bde
Author: Raphael Geissert <[email protected]>
Date:   Mon May 10 02:19:28 2010 -0500

    checkbashisms: Detect use of $((n++)) (and similar variants)
    
    This is a very simple implementation that doesn't handle cases such as
    $((n-m++)) or $(((n-1)-m++))
    
    Closes: #572006
    
    Signed-off-by: Raphael Geissert <[email protected]>
    Signed-off-by: James Vega <[email protected]>

diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
index 182c531..f5c79e4 100755
--- a/scripts/checkbashisms.pl
+++ b/scripts/checkbashisms.pl
@@ -540,6 +540,10 @@ sub init_hashes {
        qr'\$\{?SHLVL\}?\b'           => q<$SHLVL>,
        qr'<<<'                       => q<\<\<\< here string>,
        $LEADIN . qr'echo\s+(?:-[^e\s]+\s+)?\"[^\"]*(\\[abcEfnrtv0])+.*?[\"]' 
=> q<unsafe echo with backslash>,
+       qr'\$\(\(\s*\w+\+\+\s*\)\)'   => q<'$((n++))' should be '$n; 
$((n=n+1))'>,
+       qr'\$\(\(\s*\+\+\w+\s*\)\)'   => q<'$((++n))' should be '$((n=n+1))'>,
+       qr'\$\(\(\s*\w+\-\-\s*\)\)'   => q<'$((n--))' should be '$n; 
$((n=n-1))'>,
+       qr'\$\(\(\s*\-\-\w+\s*\)\)'   => q<'$((--n))' should be '$((n=n-1))'>,
     );
 
     %singlequote_bashisms = (

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to