Skip to content

Files

Latest commit

 

History

History
27 lines (16 loc) · 727 Bytes

SC2223.md

File metadata and controls

27 lines (16 loc) · 727 Bytes

Pattern: Use of unquoted parameter for :

Issue: -

Description

This statement is an idiomatic way of assigning a default value to an environment variable. However, even though it's passed to : which ignores arguments, it's better to quote it.

If COLUMNS='/*/*/*/*/*/*', the unquoted, problematic code may spend 30+ minutes trashing the disk as it unnecessarily tries to glob expand the value.

The correct code uses double quotes to avoid glob expansion, and therefore does not have this problem.

Example of incorrect code:

: ${COLUMNS:=80}

Example of correct code:

: "${COLUMNS:=80}"

Further Reading