Tuesday, November 11, 2014

Multi Line comment in Shell Script

We know that we can comment a line using '#' in Shell Script, but what if we want to comment a huge block of code? If we use '#' to comment that block then this can be very tedious task. Rather than using single line comment we can use multi line comment. In this tutorial i will show you how to use multi-line comment in Shell Script.

In Shell Script multi line comment can be of form 

<<'COMMENT'

what ever written here is a comment

COMMENT

Let see example of multi line comment

  1. #!/bin/bash
  2. echo "Hii guys"
  3. #starting of mullti line commnent
  4. <<'COMMENT'
  5. read a
  6. echo "No line in this block will execute"
  7. COMMENT
  8. echo "Hello Guys"
  9. exit

No comments:

Post a Comment