shell
字符拼接
#!/bin/bash
name="Shell"
url="http://c.biancheng.net/shell/"
str1=$name$url #中间不能有空格
str2="$name $url" #如果被双引号包围,那么中间可以有空格
str3=$name": "$url #中间可以出现别的字符串
str4="$name: $url" #这样写也可以
str5="${name}Script: ${url}index.html" #这个时候需要给变量名加上大括号
echo $str1
echo $str2
echo $str3
echo $str4
echo $str5
参考:
[1] http://c.biancheng.net/view/1114.html
[2] http://c.biancheng.net/view/743.html
[3] https://stackoverflow.com/questions/2459286/unable-to-set-variables-in-bash-script
mac的expect
需要brew安装
brew install expect
传参数:set timeout 30
参考:
[1] https://blog.csdn.net/Jerome_s/article/details/77351507
[2] https://mengshang918.github.io/blog/docs/操作系统/linux/脚本/c89e3ed149c086944696ba0fe3a5ffde/
[3] https://www.cnblogs.com/qingfeng2010/articles/10871041.html