Meaning of “[: too many arguments” error from if [] (square brackets)
If your $VARIABLE is a string containing spaces or other special characters, and single square brackets are used (which is a shortcut for the test command), then the string may be split out into multiple words. Each of these is treated as a separate argument. So that one variable is split out into many arguments: The same will be true for any … Read more