The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →An unquoted shell expansion can turn one variable reference into several command-line arguments. Shell splitting and filename expansion may change both how many arguments a command receives and what those arguments name. For a single pathname, quote the expansion; for an intentional list of arguments, store and pass the arguments separately.
One terminology note: ShellCheck’s severity scale includes error, warning, info and style, and a recent diagnostic example labels SC2086 as info. So the title’s “lowest-severity warning” is a useful hook, but SC2086 is commonly shown at the info level, below warning on that scale. ShellCheck’s manual lists the levels; a 2026 issue reproduces the SC2086 label.
As an Amazon Associate I earn from qualifying purchases.
What SC2086 is warning about
ShellCheck’s diagnostic says: “Double quote to prevent globbing and word splitting.” SC2086’s documentation is about what the shell does to an unquoted expansion before it runs the command.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallConsider a command such as rm $target. If $target expands to text containing separators, the shell may split that text into separate words according to IFS. It may then treat words containing glob characters such as * as filename patterns and replace them with matching names in the current directory. The command receives the resulting arguments—not necessarily the single pathname the script’s source line seems to imply.
#1 Best Overall
In an rm scenario, that means a variable whose value contains separators and a glob pattern can lead to multiple path arguments. If matching files are among them, rm can act on files the script never named literally. This describes how the shell can transform arguments; it does not verify any particular two-file deletion incident.
Quote a scalar value to keep it intact
If a variable represents one pathname or other single value, quote its expansion so spaces, newlines and glob characters remain data rather than triggering splitting or filename expansion:
Rank #2
rm -- "$target"
The key SC2086 remedy illustrated here is "$target". The -- shown is a familiar way to mark the end of options for commands that support it; check the command’s own behavior and portability requirements before relying on it.
ShellCheck’s minimal example is echo $1: although it may look like it prints one argument, an unquoted expansion can split and glob-expand its value. Its suggested form is echo "$1".
Rank #3
- Used Book in Good Condition
Pass a list as separate arguments, not as a space-separated string
Quoting is not a general way to turn text containing spaces into several arguments. If a string such as "-l -a" is quoted, the shell passes it as one argument. When a command needs several options or values, represent them as separate arguments and preserve their boundaries.
| Approach | Best fit | Portability and argument handling |
|---|---|---|
Bash array, expanded as "${args[@]}" |
A list of arguments in Bash or another shell with array support | Keeps each array element as a separate argument, including values containing spaces or glob characters. The SC2086 guide names Bash, ksh and zsh as supporting arrays. |
Positional parameters passed as "$@", often through a function |
A list of arguments in POSIX shell | Preserves the separate positional parameters without relying on shell arrays. The guide demonstrates setting them with set -- and passing them with "$@". |
Bash: use an array for a list
Store each argument as its own array element, then expand the elements with "${args[@]}":
Rank #4
args=(--name "value with spaces" "*.txt")
command "${args[@]}"
The quoted array expansion preserves each element as one argument. A glob character inside an element stays literal rather than expanding to matching filenames.
POSIX shell: use positional parameters
In POSIX shell code, positional parameters can hold a list of arguments. Pass them with "$@", including when calling a function:
Best Value
run_command() {
command "$@"
}
set -- --name "value with spaces" "*.txt"
run_command "$@"
Here, set -- assigns separate positional parameters, and each "$@" passes them through without merging them into one string.
Why changing IFS or disabling globbing is not the usual fix
ShellCheck’s guide describes changing IFS or using set -f to control splitting or globbing for particular intentional-splitting tasks. Those controls change shell behavior; they do not make a space-separated string a reliably structured list. For ordinary command construction, use a quoted scalar for one value or arrays or positional parameters for multiple values.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →




