Block Comments in a Shell Script

后端 未结 12 1225
小鲜肉
小鲜肉 2020-12-02 03:36

Is there a simple way to comment out a block of code in a shell script?

12条回答
  •  我在风中等你
    2020-12-02 04:07

    In Vim:

    1. go to first line of block you want to comment
    2. shift-V (enter visual mode), up down highlight lines in block
    3. execute the following on selection :s/^/#/
    4. the command will look like this:

        :'<,'>s/^/#
      
    5. hit enter

    e.g.

    shift-V
    jjj
    :s/^/#
    
    

提交回复
热议问题