全球主机交流论坛
标题:
MJJ们,圣诞快乐!
[打印本页]
作者:
jacklondon
时间:
2023-12-19 17:17
标题:
MJJ们,圣诞快乐!
本帖最后由 jacklondon 于 2023-12-19 18:52 编辑
#!/bin/bash
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
复制代码
这将在终端上输出一个圣诞树图像,希望大家喜欢。
作者:
xftaw
时间:
2023-12-19 17:19
小尾巴~~~~~
看签名>>>
作者:
1900
时间:
2023-12-19 17:22
雕虫小技竟敢班门弄斧~大威天龙!~咚呲咚咚,咚咚呲咚咚
作者:
念念不忘
时间:
2023-12-19 17:23
#!/bin/bash
draw_christmas_tree() {
echo " * "
echo " / \\ "
echo " / \\ "
echo " /_____\\ "
echo " / | \\ "
echo " / | \\ "
echo " /_____|______\\ "
echo " | | "
echo " | | "
}
# 调用函数
draw_christmas_tree
复制代码
------
作者:
冲浪麦浪花郎
时间:
2023-12-19 17:24
尴尬
作者:
mdd
时间:
2023-12-19 17:25
不够炫
作者:
920
时间:
2023-12-19 17:29
要不搞一个炫酷一点的
作者:
summer365
时间:
2023-12-19 17:34
# The following line tells the shell what program to interpret the script with
#!/bin/bash
# tput is a command to manipulate the terminal, it can be used to change the color of text, apply effects, and generally brighten things up.
trap "tput reset; tput cnorm; exit" 2
clear
tput civis
lin=2
col=$(($(tput cols) / 2))
c=$((col-1))
est=$((c-2))
color=0
# Set the text color to green to write the tree
tput setaf 2; tput bold
# Write the tree
for ((i=1; i<40; i+=2))
{
tput cup $lin $col
for ((j=1; j<=i; j++))
{
echo -n \*
}
let lin++
let col--
}
## Set the color to brown for the trunk
tput sgr0; tput setaf 130
# Write the Trunk in three lines
for ((i=1; i<=3; i++))
{
tput cup $((lin++)) $c
echo 'mWm'
}
# Write a greeting
tput setaf 93; tput bold
tput cup $lin $((c - 15)); echo SCALEWAY wishes you Merry Christmas
tput cup $((lin + 1)) $((c - 11)); echo And a Happy New Year 2024
let c++
k=1
# Configure lights and decorations
while true; do
for ((i=1; i<=35; i++)) {
# Turn off the lights
[ $k -gt 1 ] && {
tput setaf 2; tput bold
tput cup ${line[$[k-1]$i]} ${column[$[k-1]$i]}; echo \*
unset line[$[k-1]$i]; unset column[$[k-1]$i] # Array cleanup
}
li=$((RANDOM % 9 + 10))
start=$((c-li+2))
co=$((RANDOM % (li-2) * 2 + 1 + start))
tput setaf $color; tput bold # Switch colors
tput cup $li $co
echo o
line[$k$i]=$li
column[$k$i]=$co
color=$(((color+1)%8))
}
k=$((k % 2 + 1))
done
复制代码
网上找的,效果还可以
欢迎光临 全球主机交流论坛 (https://443502.xyz/)
Powered by Discuz! X3.4