I forgot about another way I use it. Here 'tis.
Consider this loop:
for i in {1..100}do
some-command-or-other $idone
If you want to comment out the loop, you could comment out the whole thing by putting a comment character in front of each line, but that's tedious. Easier would be to comment out the one-line loop body, like this
for i in {1..100}do
# some-command-or-other $idone
Except, um, that's an empty loop body and a syntax error.
bash: syntax error near unexpected token `done'
This, however, is fine:
for i in {1..100}do
: some-command-or-other $idone
That loop body isn't empty, it just doesn't do anything. No fuss, no muss.
No comments:
Post a Comment