在 Bash 中,如何获取字符串中子字符串的位置,从字符位置 n 开始搜索
我是 Bash 脚本的新手,以前我在 Windows 中使用过 Visual Basic,正在寻找 VB 的 Bash 等效字符串函数inStr()。 VB 示例: strMain = "abcABC123ABCabc" searchStartPos = 6 'Start searching at 6th char. subStr = "AB" 'Look for "AB". pos = inStr(searchStartPos, strMain, subStr) print pos 10 ...