shell summary- shell 中的单行注释和多行注释 + tail

1. 单行注释

众所周知,#  比如想要注释:echo “ni”

# echo "ni"

 

2. 多行注释:

法一:

: << !

语句1

语句2

语句3

语句4

!

例如:

linux101:/home/wsj # sh dian
ni
ni
ni
ni
ni
ni

linux101:/home/wsj # more dian
#!/bin/ksh
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"

:< echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
!

法二:

: '

语句1

语句2

语句3

语句4

'

例如:

linux101:/home/wsj # sh dian
ni
ni
ni
ni
ni
ni

linux101:/home/wsj # more dian
#!/bin/ksh
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"

: '
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
'

 2014-02-03-06补充:

法三:

if false; then

语句1

语句2

语句3

语句4

fi

linux101:/home/wsj # sh dian
ni
ni
ni
ni
ni
ni

linux101:/home/wsj # more dian
#!/bin/ksh
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"

if false; then
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
echo "ni"
fi

 
原文:https://blog.csdn.net/lansesl2008/article/details/20558369 
 

 

tail -f      等同于--follow=descriptor,根据文件描述符进行追踪,当文件改名或被删除,追踪停止

tail -F     等同于--follow=name  --retry,根据文件名进行追踪,并保持重试,即该文件被删除或改名后,如果再次创建相同的文件名,会继续追踪

tailf        等同于tail -f -n 10(貌似tail -f或-F默认也是打印最后10行,然后追踪文件),与tail -f不同的是,如果文件不增长,它不会去访问磁盘文件,所以tailf特别适合那些便携机上跟踪日志文件,因为它减少了磁盘访问,可以省电

你可能感兴趣的:(shell,shell脚本)