Comments in a multi-line bash command

Posted by Nicolas Raoul on Super User See other posts from Super User or by Nicolas Raoul
Published on 2011-01-28T05:41:22Z Indexed on 2011/02/24 23:27 UTC
Read the original article Hit count: 348

Filed under:
|
|
|
|

This single-command BASH script file is difficult to understand, so I want to write a comment for each of the actions:

grep -R "%" values* \
| sed -e "s/%/\n%/" \
| grep "%" \
| grep -v " % " \
| grep -v " %<" \
| grep -v "%s" \
| grep -v "%d" \
| grep -v "%1$s"

I would hate having to duplicate lines, or having each comment far away from the line it applies to.
But at the same time BASH does not seem to allow "in-line" comments.

Any elegant way to solve this problem?

© Super User or respective owner

Related posts about bash

Related posts about pipe