Back when terminals were used instead of desktops, the shell (either CMD or /bin/sh) was the way most programmers interacted with a computer. Today, filenames are routinely created with characters the shell considers delimiters. This poses problems for shell scripting.

I'm in the habit of using "${var}" in all my shell scripts, but using this construct with impunity isn't always wise, because it's common to accept command line parameters or parameters to a shell function and iterate over them. If the filenames contain delimiters (usually spaces), the for loops may not execute properly.

To sort this out, I ran an experiment and created a cheat sheet. See below.

From the experiment, you can see that only the ff3 construct is problematic. I'm sure there are situations where using it is necessary, but processing filenames as arguments to a function is certainly not one of them.

My takeaway, never use construct ff3 and consult this article if you intend to use it.

Personally, I ways use ff1 and quoted: "${i}", but this takes a lot of complicated typing. Sometimes I take shortcuts to skip the {}, which doesn't matter much. But skipping using ${i} or $i without quotes can have unexpected results. These issues don't seem to be a concern using a for as shown above however.