shell指令碼之---聖誕樹
#!/bin/bash
#this is auto creat
#version:1.0
#author:zhlz
#Date: 2017-03-24
#read -p "三角樹頭高度幾層: " Lines
#read -p "輸入要幾層聖誕樹 : " Quens
#read -p “輸入根的層數: " Gen
Lines=10
Quens=3
Gen=3
#樹頭
for L_Num in seq 1 $Lines
do
A_Num=L_Num*2-1]
S_Num=Lines-KaTeX parse error: Expected 'EOF', got '#' at position 8: L_Num]
#̲左
Pil=
for h in
seq 1 $Pil
do
QQ=RANDOM%5]
case $QQ in
2)
echo -e “\033[37m❄\033[0m\c”
;;
*)
echo -e " \c”
esac
done
for i in
seq 1 $S_Num
do
echo -e " \c"
done
#中
for j in seq 1 $A_Num
do
#新增鈴鐺
QQ=$[$RANDOM%16] Yan=$[$RANDOM%7] case $QQ in 2) echo -e "\033[3$Yan;5m♥\033[0m\c" ;; *) echo -e "\033[32;1mA\033[0m\c" esac done
#right
for k in seq 1 $S_Num
do
QQ=RANDOM%5]
case $QQ in
2)
echo -e “\033[37m❄\033[0m\c”
;;
)
echo -e " \c"
esac
done
echo
done
#樹中
#插入層數
for n in seq 1 $Quens
do
nnn=n+1]
for L_Num in seq $nnn $Lines
do
A_Num=L_Num4-1]
S_Num=Lines2-1-$L_Num2]
for i in seq 1 $S_Num
do
#插入彩條
if [ $L_Num -eq $nnn -a [[$RANDOM%7]
[ KaTeX parse error: Expected 'EOF', got '&' at position 13: Cai -eq 0 ] &̲& echo -e "\033…Yan;5m|\033[0m\c" || echo -e " \c"
else
QQ=RANDOM%5]
case $QQ in
2)
echo -e “\033[37m❄\033[0m\c”
;;
*)
echo -e " \c"
esac
fi
done
for j in seq 1 $A_Num
do
#新增鈴鐺
QQ=RANDOM%15]
Yan=RANDOM%7]
case KaTeX parse error: Expected 'EOF', got '\0' at position 91: … echo -e "\̲0̲33[3Yan;5m♥\033[0m\c"
;;
*)
echo -e “\033[32;1mA\033[0m\c”
esac
done
for k in seq 1 $S_Num
do
if [ $L_Num -eq $nnn -a [[$RANDOM%7]
[ KaTeX parse error: Expected 'EOF', got '&' at position 13: Cai -eq 0 ] &̲& echo -e "\033…Yan;5m|\033[0m\c" || echo -e " \c"
else
QQ=RANDOM%5]
case $QQ in
2)
echo -e “\033[37m❄\033[0m\c”
;;
*)
echo -e " \c"
esac
fi
done
echo
done
done
for b in seq 1 $Gen
do
LLines=Lines*2-4]
for q in seq 1 $LLines
do
echo -e " \c"
done
for p in {1…5}
do
echo -e “\033[40mH\033[0m\c”
done
echo
done