No, the backslash at the end of a line acts on the next character, the newline character (removing it). If you add a space and a #
character, the backslash will act on the space instead (quoting it), not the newline character. You also can't add a comment at the end of the line and then a backslash character, because the comment would effectively comment out the rest of the continued line.
What you could do is to create an array for the arguments, and comment the various parts of it as you do it, and then use that in a call to your utility:
yad_args=(
# A timeout of 20 is used in testing; production uses 2.
#--timeout=20
--timeout=2
--undecorated # We don't want decorations.
--posx=1200 --posy=633
--title=" " # Spacey title.
--window-icon="${XDG_DATA_HOME:-$HOME/.local/share}"/file-manager/spanner_white.png
--no-buttons
--no-focus # No focus for you!
--text="All print jobs cancelled"
)
yad "${yad_args[@]}"
While declaring each element of the array yad_args
, it's possible to add comments at the end of the lines.
Note that when using the array in the call to yad
, the expansion must be quoted exactly as shown above, or you will have issues with array elements containing spaces and/or filename globbing characters.
ARGS += " --undecorated"
, and so multiline comments before each important argument item. I think it is more aestetic (on most IDEs). – Giacomo Catenazzi Sep 26 '23 at 07:52