Inline comments for Bash?

前端 未结 8 834
深忆病人
深忆病人 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
    
    0 讨论(0)
  • 2020-12-07 14:21

    $(: ...) is a little less ugly, but still not good.

    0 讨论(0)
提交回复
热议问题