Chinaunix首页 | 论坛 | 博客
  • 博客访问: 116585
  • 博文数量: 84
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 0
  • 用 户 组: 普通用户
  • 注册时间: 2016-11-17 12:39
个人简介

大连Linux/Unix高端就业、认证培训的领导者。

文章分类

全部博文(84)

文章存档

2013年(25)

2012年(1)

2010年(4)

2009年(9)

2008年(14)

2007年(4)

2006年(27)

分类: LINUX

2008-05-16 18:11:04

要求实名
阅读(2035) | 评论(13) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2008-05-24 17:04:18

编写名为t的程序显示一天中的时间,不用用24小时制的时间,而用a.m.或者p.m.符号形式。 方法一:用shell内部整数算术运算转换24小时制的时间 time=`date |cut -d' ' -f4` h=`echo $time |cut -d: -f1` m=`echo $time |cut -d: -f2` if [ "$h" -gt 12 ] then echo "$(($h - 12)):$m pm" else echo "$h"':'"$m"' am' fi 方法二:用case命令 time=`date |cut -d' ' -f4` h=`echo $time |cut -d: -f1` m=`echo $time |cut -d: -f2` if [ $h -gt 12 ] then case "$h" in 13) echo "1:"$m" pm";; 14) echo "2:$m pm";; 15) echo "3:$m pm";;

chinaunix网友2008-05-24 16:24:36

参数是合法变量名,显示YES,否则NO. char=`echo $1 |grep -v '[0-9]' -a '! _' | wc -l` > /dev/null /null if [ ! -z "char" ] then echo "use: valid char" elif [ "$char" -eq 0 ] then echo "Yes" else echo "No" fi ^_* 老师哦,帮看看呗,没成功)

chinaunix网友2008-05-24 16:16:11

要求:把0-99个数字分别转换成英文。。。 if [ "$#" -ne 1 ] then echo "use: Number No." exit 1 else [ "$#" -ge 10 -o "$#" -le 99 ] fi case "$1" in 0)echo zero;; 1)echo one;; 2)echo two;; 3)echo three;; 4)echo four;; 5)echo five;; 6)echo six;; 7)echo seven;; 8)echo eight;; 9)echo nine;; 10)echo ten;; 11)echo eleven;; 12)echo twelve;; 13)... 14)... ...

chinaunix网友2008-05-24 16:13:21

number shell 解: if [ "$#" -ne 1 ] then echo "use: Number No." exit 1 else [ "$#" -ge 10 -o "$#" -le 99 ] fi number="$1" if [ "$number" -le 12 ] then case "$1" in 0)echo zero;; 1)echo one;; 2)echo two;; 3)echo three;; 4)echo four;; 5)echo five;; 6)echo six;; 7)echo seven;; 8)echo eight;; 9)echo nine;; 10)echo ten;; 11)echo eleven;; 12)echo twelve;; esac

chinaunix网友2008-05-24 16:10:28

8-9练习 1. a=`echo $1 |cut -c1 ` echo "$a" |grep '[_0-9]' >/dev/null b=$? if [ "$b" -eq 1 ] then echo "yes" else echo "no" fi