一、脚本文件
#!/bin/bash
#用shell编写一个圣诞树
#创建时间2021-12-21
trap "tput reset; tput cnorm; exit" 2
clear
tput civis
lin=2
col=$(($(tput cols) / 2))
c=$((col-1))
est=$((c-2))
color=0
tput setaf 2; tput bold
# 打印树叶
for ((i=1; i<20; i+=2))
{
tput cup $lin $col
for ((j=1; j<=i; j++))
{
echo -n \*
}
let lin++
let col--
}
tput sgr0; tput setaf 3
# 打印树干
for ((i=1; i<=2; i++))
{
tput cup $((lin++)) $c
echo '||'
}
new_year=$(date +'%Y')
let new_year++
tput setaf 1; tput bold
tput cup $lin $((c - 6)); echo 圣 诞 节 快!!!
tput cup $((lin + 1)) $((c - 10)); echo And lots of CODE in $new_year
let c++
k=1
#装饰一下
while true; do
for ((i=1; i<=35; i++)) {
# Turn off the lights
[ $k -gt 1 ] && {
tput setaf 2; tput bold