In sh, bash, and many other shells, # is used to start a comment.
If you’re like me, you probably use it quite a bit when writing actual shell
scripts. When in your terminal, though, using # probably does not really come
to mind often.
However, it can actually be quite handy! For example, when typing commands in production machines, it helps guard you from accidentally pressing Enter too early:
# rm -rf /some/dir/not/fully/specified
It can also help you reverse-search your shell history. I personally like using
fzf to search for my comments:
mogrify -auto-orient \
-strip \
-geometry 600x600^ \
-crop 600x600+0+0 \
-gravity Center \
-gaussian-blur 0.05 \
-quality 85 \
-format webp * # That one mogrify command I used for my website
Or, you can use it save links / TODOs:
# TODO(2024-03-08): Read https://craftinginterpreters.com/