Skip to content

Files

Latest commit

 

History

History
25 lines (15 loc) · 578 Bytes

SC2292.md

File metadata and controls

25 lines (15 loc) · 578 Bytes

Pattern: Use of [ ] for test in Bash/Ksh

Issue: -

Description

ShellCheck has been explicitly asked to warn about uses of [ .. ] in favor of the extended Bash/Ksh test [[ .. ]].

[[ .. ]] suppresses word splitting and globbing, supports a wider variety of tests, and is generally safer and better defined than [ .. ].

Example of incorrect code:

[ -e /etc/issue ] 

Example of correct code:

[[ -e /etc/issue ]]

Further Reading