#!/bin/bash
a="The cat sat on the mat"
test="cat"
awk -v a="$a" -v b="$test" 'BEGIN{print index(a,b)}'
输出
bogon:Desktop macname$ ./test.sh
5
参考:
#!/bin/bash
a="The cat sat on the mat"
test="cat"
awk -v a="$a" -v b="$test" 'BEGIN{print index(a,b)}'
输出
bogon:Desktop macname$ ./test.sh
5
参考:
上一篇:shell for 循环演示
下一篇:curl 设置超时时间
与字符串相关的函数
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M