Linux Shell脚本入门教程系列之(四)Shell注释

本文是Linux Shell脚本系列教程的第(四)篇,更多shell教程请看:Linux Shell脚本系列教程

与许多的编程语言一样,Shell中也有注释符号,继上一篇之后,今天就为大家来介绍下Shell中的注释的语法及用法。

Shell中的注释以“#”号开头,所有以“#”号开头的代码都会被解释器所忽略。

比如下面的代码:

#!/bin/bash
# Author : justcode.ikeepstudying.com
# Date : 2016-05-15
echo "What is your name?"
read PERSON
echo "Hello, $PERSON"

其中以“#”号开头的Author字段和Date字段就是Shell中的注释。

而且Shell中没有多行注释,只有单行注释,所以只有这一种注释方式来注释代码。

 

原文:Linux Shell系列教程之(四)Shell注释

本文:Linux Shell脚本入门教程系列之(四)Shell注释

Loading

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.