⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex45a.sh

📁 Shall高级编程
💻 SH
字号:
#!/bin/bashechoecho "String operations using \"expr \$string : \" construct"echo "==================================================="echoa=1234zipper5FLIPPER43231echo "The string being operated upon is \"`expr "$a" : '\(.*\)'`\"."#     Escaped parentheses grouping operator.            ==  ==#       ***************************#+          Escaped parentheses#+           match a substring#       ***************************#  If no escaped parentheses...#+ then 'expr' converts the string operand to an integer.echo "Length of \"$a\" is `expr "$a" : '.*'`."   # Length of stringecho "Number of digits at the beginning of \"$a\" is `expr "$a" : '[0-9]*'`."# ------------------------------------------------------------------------- #echoecho "The digits at the beginning of \"$a\" are `expr "$a" : '\([0-9]*\)'`."#                                                             ==      ==echo "The first 7 characters of \"$a\" are `expr "$a" : '\(.......\)'`."#         =====                                          ==       ==# Again, escaped parentheses force a substring match.#echo "The last 7 characters of \"$a\" are `expr "$a" : '.*\(.......\)'`."#         ====                  end of string operator  ^^#  (actually means skip over one or more of any characters until specified#+  substring)echoexit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -