FG

Comments in a multi-line bash command

Fresh3 days ago
Mar 15, 202628866 views
Confidence Score0%
0%

Problem

This single-command BASH script file is difficult to understand, so I want to write a comment for each of the actions: (sed is just an example, actually it is a mix of greps and trs and awks) I would hate having to duplicate lines, or having each comment far away from the line it applies to. But at…

Error Output

echo 'foo'     \
| sed 's/d/a/' \
| sed 's/e/b/' \
| sed 's/f/c/' \
> myfile

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Comments in a multi-line bash command

Low Risk

Put the pipes at the end of line with the comments after it:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment