sh04.sh
#!/bin/bash
#program
# user inputs 2 integer numbers;program will cross these two numbers.
#History:
#2014/01/06 yusiyu First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
echo -e "you should input 2 numbers,i will cross them!\n "
read -p "first number: " firstnu
read -p "second number: " secnu
total=$(( $firstnu * $secnu ))
echo -e "\nthe result of $firstnu x $secnu is ==> $total"
#!/bin/bash
#program
# user inputs 2 integer numbers;program will cross these two numbers.
#History:
#2014/01/06 yusiyu First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
echo -e "you should input 2 numbers,i will cross them!\n "
read -p "first number: " firstnu
read -p "second number: " secnu
total=$(( $firstnu * $secnu ))
echo -e "\nthe result of $firstnu x $secnu is ==> $total"

本文介绍了一个简单的Bash脚本,该脚本允许用户输入两个整数,并返回这两个数相乘的结果。脚本首先定义了环境变量PATH,然后通过read命令获取用户输入的两个整数,最后使用算术运算符计算并输出结果。
1007

被折叠的 条评论
为什么被折叠?



