Skip to content

Instantly share code, notes, and snippets.

@ipv6rs
Created April 28, 2024 23:30
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 ipv6rs/a2ba167d6602d7579310560e84168eec to your computer and use it in GitHub Desktop.
Save ipv6rs/a2ba167d6602d7579310560e84168eec to your computer and use it in GitHub Desktop.
Space Matters

Space Matters

Can you spot the difference between the following 2 scripts?

#!/bin/bash
ps \ 
  aux
#!/bin/bash
ps \
  aux

Hint: One works and one doesn't.

Spoiler:

Makefiles and Linus aren't the only ones who care about spacing.

There's an extra space after the \ in the first example.

We actually experienced a bug on Cloud Seeder due to this issue. It took us a bit to spot it!

You can remove trailing whitespace like this:

sed 's/[[:blank:]]*$//'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment