??????????????/usr/local/sbin??
???????????? sh -x ???.sh -x???????й???
????1?????????????? ?????????????????$?????
????#!/bin/bash
????##???????????????????÷?????
????d=`date +"%H:%M:%S"`
????echo "The script begin at $d"
????echo "Now we'll sleep 2 seconds"
????sleep 2
????d1=`date +"%H:%M:%S"`
????echo "The script end at $d"
????2?????????????????????[]??????????
????#! /bin/bash
????a=1
????b=2
????##?????????[]??????
????sum=$[$a+$b]
????echo "$a + $b = $sum"
????3???????к????????? ???read????
????#! /bin/bash
????read -p "Please input a number: " x
????read -p "Please input a number: " y
????sum=$[$x+$y]
????echo "The sum of the tow numbers is : $sum"
????4??shell?е???????
????#! /bin/bash
????echo "$1 $2 $3 $0"
????1 2 ?????е??????? ???????е??????????????????0?????????????
????# sh option.sh 1 2 3
??????д?????????????????????
????1 2 3 option.sh
????5??shell?е?????ж?
????????else??if ???if??????ж???????(())???????
????#! /bin/bash
????read -p "Please input your score: " a
????if ((a<60)); then
????echo "You didn't pass the exam."
????fi
????5.1????else ???????????
????#! /bin/bash
????read -p "Please input your score: " a
????if ((a<60)); then
????echo "You didn't pass the exam."
????else
????echo "Good! You passed the exam."
????fi
????5.2??????else if(????c?е????)??shell?б???elif
????#! /bin/bash
????read -p "Please input your score: " a
????if ((a<60)); then
????echo "You didn't pass the exam."
????elif ((a>=60)) && ((a<85)); then
????echo "Good! You passed the exam."
????else
????echo "Very good! Your score is very heigh"
????fi
????5.3??case ????ж?
????#! /bin/bash
????read -p "Input a number: " n
????a=$[$n%2]
????case $a in
????1)
????echo "The number is odd."
????;;
????0)
????echo "The number is even."
????;;
????*)
????echo "It's not a number"
????;;
????esac
????* ????????
????6??for???
??????????????£?
????#! /bin/bash
????for file in `ls`;do
????echo $file
????done
????7??while ???
????#! /bin/bash
????a=5
????while [ $a -ge 1 ]; do
????echo $a
????a=$[$a-1]
????done