Skip to content

Files

Latest commit

 

History

History
35 lines (24 loc) · 518 Bytes

SC2276.md

File metadata and controls

35 lines (24 loc) · 518 Bytes

Pattern: Use of = in command name

Issue: -

Description

This was likely intended as either a comparison or an assignment.

To compare two values, use e.g. [ "$var" = "42" ]

To assign a value, use e.g. var="42".

Example of incorrect code:

"$var"=42
if "$var"=42
then
  true
fi

Example of correct code:

var=42
if [ "$var" = 42 ]
then
  true
fi

Further Reading