Chinaunix首页 | 论坛 | 博客
  • 博客访问: 12494
  • 博文数量: 2
  • 博客积分: 71
  • 博客等级: 民兵
  • 技术积分: 20
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-21 10:01
个人简介

asdfsa

文章分类
文章存档

2011年(2)

最近访客

分类:

2011-09-21 11:50:53

原文地址:shell也玩段注释 作者:ubuntuer

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' 還可以將裡面的變量擴展關

阅读(915) | 评论(0) | 转发(0) |
0

上一篇:Linux 下ftp自动登录

下一篇:没有了

给主人留下些什么吧!~~