1、第一个hello world
#!/bin/bash
echo 'hello world'
#!/bin/bash:代表的是使用的是哪一种shell
2、变量内容由使用者决定(使用定义过的变量用在变量名前加$)
#!/bin/bash
read -p "please input your firstname:" firstname
read -p "please input your lastname:" lastname
echo "\n Your full is: $firstname $lastname"
3、数字运算
#!/bin/bash
read -p "first number: " firstnum
read -p "second number: " secondnum
total=$(($firstnum*$secondnum))
echo "The result of $firstnum * $secondnum is $total"
运算方式:$((运算内容))