Bash 学习笔记

1. 字符串分割

${str:startIndex:length}

 

2.字符索引

expr index ‘c’ $str

 

3.执行脚本参数

$1 – $9 – The first 9 arguments to the Bash script. (As mentioned above.)

 

4.参数数量

$# – How many arguments were passed to the Bash script.

 

5.所有传参名

$@ – All the arguments supplied to the Bash script.

 

6.字符串长度

${#string} — 获取字符串长度

 

7.