Skip to main content
Tweeted twitter.com/super_user/status/1567075137224155136
deleted 98 characters in body
Source Link
Nicolas Raoul
  • 11.2k
  • 19
  • 68
  • 105

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

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

(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 the same time BASH does not seem to allow "in-line" comments.

Any elegant way to solve this problem?

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

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

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?

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

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

(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 the same time BASH does not seem to allow "in-line" comments.

Any elegant way to solve this problem?

deleted 98 characters in body
Source Link
Nicolas Raoul
  • 11.2k
  • 19
  • 68
  • 105

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

grepecho -R'foo' "%" values*   \
| sed -e "s's/%d/\n%a/" \
| grep "%" \
| grep -v " % " \
| grep -v " %<" \
| grep -v "%s"' \
| grep -vsed "%d"'s/e/b/' \
| grep -vsed "%1$s"'s/f/c/'

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?

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?

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

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

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?

edited tags
Link
Mikel
  • 9k
  • 1
  • 42
  • 37
Source Link
Nicolas Raoul
  • 11.2k
  • 19
  • 68
  • 105
Loading