Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 455 Bytes

SC3018.md

File metadata and controls

28 lines (19 loc) · 455 Bytes

Pattern: Use of undefined ++/--

Issue: -

Description

Prefix and postfix increment and decrement are extensions in bash and ksh. They're not supported in dash or POSIX sh.

Example of incorrect code:

#!/bin/sh
i=1
echo "$((i++))"

Example of correct code:

#!/bin/sh
i=1
echo "$i"
i=$((i+1))

Further Reading