各位看官们,新建立一个叫sample.sh的脚本文件,然后在里面输入布下的内容,并且保存。
#! /bin/bash
echo "-----------------the starting line of shell-----------------"
echo "Countdown: 1 minuts"
count=60 # this time can be setted by yourself
echo -n "It is :"
tput sc
echo -n $count
while [ $count -gt 0 ]
do
let count--
sleep 1
tput rc
tput ed
echo -n "$count second"
done
echo
echo "-----------------the ending line of shell-----------------"
在终端中运行该程序可以得到以下的结果:
-----------------the starting line of shell-----------------
Countdown: 1 minuts
It is :0 second
-----------------the ending line of shell-----------------