Inline comments for Bash?

前端 未结 8 918
深忆病人
深忆病人 2020-12-07 13:28

I\'d like to be able to comment out a single flag in a one-line command. Bash only seems to have from # till end-of-line comments. I\'m looking at tricks like:<

8条回答
  •  温柔的废话
    2020-12-07 14:11

    Most commands allow args to come in any order. Just move the commented flags to the end of the line:

    ls -l -a /etc # -F is turned off
    

    Then to turn it back on, just uncomment and remove the text:

    ls -l -a /etc -F
    

提交回复
热议问题