06 2012 档案

摘要:字符串操作:1.获取字符串的长度 ${#stringname} expr length $string expr "$string" : '.*' #这个没看明白2.子串索引位置 expr index $string $substring3.子串提取的方法 ${string:position} #在$string中从位置$position开始提取子串. #如果$string是"*"或者"@", 那么将会提取从位置$position开始的位置参数. ${string:position:length} #在$string中 阅读全文
posted @ 2012-06-26 16:36 Vman 阅读(495) 评论(0) 推荐(0)
摘要:View Code 1 #!/bin/bash 2 #arglist.h 3 #2012-06-14 4 5 E_BADARGS=65 6 7 if [ ! -n "$1" ] 8 then 9 echo "Usage: `basename $0` argument1 argument2 etc."10 exit $E_BADARGS11 fi12 echo13 14 index=115 #注意16 echo "Listing args with \"\$*\":"17 for arg in "$*&qu 阅读全文
posted @ 2012-06-14 20:26 Vman 阅读(2037) 评论(1) 推荐(0)