Instead I'll give a method to help avoid the problem. For awhile now,
anytime I'm using calling a command with enough options to warrant
line continuation I build them up in an array instead. This allows
splitting across lines without using a backslash at the end, and
*actually* allows comments.
This also allows the arguments to be build up gradually with some
being added conditionally.
The below actually works as written including the comments:
args=(
-re 's/abc/xyx/' # End of the alphabet is better
-re 's/123/456/' # Bigger numbers are better
# -re 's/foo/bar/' # Disable for now
)
if [ -r /some/file ]
then
args+=(-re 's/new/old/')
fi
echo abc123 | sed "${args[@]}"
For zsh you can just use $args to reference it, the way I wrote it
above will work in bash as well.