LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1246|回复: 3

为什么执行 echo `expr index "abcABC123ABCabc" 'Ca'`结果为1

[复制链接]
发表于 2007-5-28 15:32:52 | 显示全部楼层 |阅读模式
为什么执行 echo `expr index "abcABC123ABCabc" 'Ca'`结果为1,而不是12
发表于 2007-5-29 21:47:52 | 显示全部楼层
just return the first index of any char in "string2" which matched in "string1", not the whole string in "string2".
because there is a char "a" in "Ca", so the returned index is 1.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-30 12:50:40 | 显示全部楼层
Thank you! The expression is 'Numerical position in $string of first character in $substring that matches' in abs-guide-3.7 ,I think it has a mistake.
回复 支持 反对

使用道具 举报

发表于 2007-5-31 00:03:26 | 显示全部楼层
echo `expr length "$string"`
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表