LinuxSir.cn,穿越时空的Linuxsir!

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

关于字符操作符与位置参数结合问题

[复制链接]
发表于 2008-7-12 02:49:36 | 显示全部楼层 |阅读模式
大家好,这里是我实验的代码小弟初学,
  1. stringZ=abcABC123ABCabc
  2. echo "Scrip out shortest match between 'a' and 'C'"
  3. echo "\${stringZ$1 a*C}:"
  4. echo ${stringZ`$1` (a*C)}
  5. echo "Strip out longest matech between 'a' and 'C'"
  6. echo "\${stringZ$1a*C}:"
  7. echo ${stringZ$1(a*C)}
复制代码
如何实现在string里获取positional parameters value?
  1. echo ${stringZ$1(a*C)}
复制代码
上边那样写会报错,bad substitution
请问,./substring %
达到这样的效果
[code ]
${string% a*C}
[/code]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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