Skip to content

Files

Latest commit

 

History

History
36 lines (24 loc) · 816 Bytes

SC2291.md

File metadata and controls

36 lines (24 loc) · 816 Bytes

Pattern: Repeated unquoted spaces between words in echo

Issue: -

Description

ShellCheck found multiple unquoted spaces between words passed to echo. Due to the way arguments are interpreted and passed in the shell, these will collapse into a single space:

$ echo Hello        World
Hello World

If you want to output multiple spaces, such as when creating a notice or banner, make sure the spaces are quoted, e.g. by adding (or extending) double quotes to include them:

$ echo "Hello        World"
Hello        World

Example of incorrect code:

'''
echo Hello        World

Example of correct code:

echo "Hello        World"

Further Reading