[root@shell sbin]# vi read.sh
! /bin/bash
Using 'read' in shell script.
tcq 2021-04-19
read -p "Please input a number:" x
read -p "Please input another number:" y
sum=$[$x+$y]
echo "The sum of the two numbers is: $sum"
执行脚本:
[root@shell sbin]# sh read.sh
Please input a number:100
Please input another number:2
The sum of the two numbers is: 102