A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/koalaman/shellcheck/wiki/SC1007 below:

SC1007 · koalaman/shellcheck Wiki · GitHub

Remove space after = if trying to assign a value (or for empty string, use var="" ... ).
# I want programs to show text in Dutch!
LANGUAGE= nl
# I want to run the nl command with English error messages!
LANGUAGE= nl
# I want programs to show text in Dutch!
LANGUAGE=nl
# I want to run the nl command with English error messages!
LANGUAGE='' nl

It's easy to think that LANGUAGE= nl would assign "nl" to the variable LANGUAGE. It doesn't.

Instead, it runs nl (the "number lines" command) and sets LANGUAGE to an empty string in its environment.

Since trying to assign values this way is a common mistake, ShellCheck warns about it and asks you to be explicit when assigning empty strings (except for IFS, due to the common IFS= read .. idiom).

If you're familiar with this behavior and feel that the explicit version is unnecessary, you can ignore it.

https://www.gnu.org/software/bash/manual/html_node/Shell-Parameters.html https://mywiki.wooledge.org/BashPitfalls#foo_.3D_bar


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4