draw_christmas_tree() {
echo " * "
echo " / \\ "
echo " / \\ "
echo " /_____\\ "
echo " / | \\ "
echo " / | \\ "
echo " /_____|______\\ "
echo " | | "
echo " | | "
}
# 调用函数
draw_christmas_tree
将上述代码保存到一个文件(比如christmas_tree.sh),然后在终端中运行:
chmod +x christmas_tree.sh
./christmas_tree.sh
这将在终端上输出一个圣诞树图像,希望大家喜欢。