shell注释是#大家都知道,就像c的//,可是c的/**/可以实现段注释,shell怎么办到呢??
shell注释段
:<<BLOCK
...
segment
...
BLOCK
cat date.sh
#!/bin/bash
#usage:yyyymmdd
(($#!=1))||((${#1}!=8)) && { echo "Usage:yyyymmdd";exit 1; }
year=${1:0:4}
month=${1:4:2}
day=${1:6:2}
(cal $month $year|grep -q "$day" && echo ok || echo error) 2>/dev/null
#plus
:<<BLOCK
ubuntu
debian
centos
fedora
redhat
BLOCK
下面是shell高人netman的一点小PS:
: << 'BLOCK' 還可以將裡面的變量擴展關
阅读(1375) | 评论(0) | 转发(1) |
|