Skip to content

Instantly share code, notes, and snippets.

@rafaelmaeuer
Created August 28, 2023 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelmaeuer/02d54fcd565128a02c5d2486ed11d1e7 to your computer and use it in GitHub Desktop.
Save rafaelmaeuer/02d54fcd565128a02c5d2486ed11d1e7 to your computer and use it in GitHub Desktop.

General rule: quote it if it can either be empty or contain spaces (or any whitespace really) or special characters (wildcards). Not quoting strings with spaces often leads to the shell breaking apart a single argument into many.

$? doesn't need quotes since it's a numeric value. Whether $URL needs it depends on what you allow in there and whether you still want an argument if it's empty.

I tend to always quote strings just out of habit since it's safer that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment