I’d like to embed comments like this
ls -l \
-a \
# comment here
-h \
-t .
But it seems that’s not possible. Maybe some other variant does exist? Putting a comment right after the backslash or ending a comment with a backslash doesn’t help.
You cannot split a statement into multiple lines in Python by pressing Enter . Instead, use the backslash ( \ ) to indicate that a statement is continued on the next line.
In Shell or Bash shell, we can comment on multiple lines using << and name of comment. we start a comment block with << and name anything to the block and wherever we want to stop the comment, we will simply type the name of the comment.
The posts above do not have a direct solution. However, there is a direct solution that's actually mentioned in even older posts: How to put a line comment for a multi-line command and Commenting in a Bash script.
The solution I like best is:
ls -l `# long format` \
-a `# all files` \
-h `# human readable` \
-t `# time sort`
You will need both the accent grave (`) quotation and the octothorpe (#) to indicate the comment. Use them before the backslash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With