read:从键盘读入数据
# read -p “$字符串” 变量1 变量2 # 将字符串以空格分割,第一个值赋给变量1,剩下的赋给最后一个变量 #!/bin/bash read -p "请输入你的名字:" str1 str2 echo $str1 echo $str2
【结果】