当前位置:网站首页>Shell编程之matrix---装逼又炫酷
Shell编程之matrix---装逼又炫酷
2022-07-15 14:35:00 【指剑】
代码如下:
#!/bin/bash
blue="\033[0;34m"
brightblue="\033[1;34m"
cyan="\033[0;36m"
brightcyan="\033[1;36m"
green="\033[0;32m"
brightgreen="\033[1;32m"
red="\033[0;31m"
brightred="\033[1;31m"
white="\033[1;37m"
black="\033[0;30m"
grey="\033[0;37m"
darkgrey="\033[1;30m"
colors=($blue $brightgreen $grey)
spacing=${1:-100}
scroll=${2:-0}
screenlines=$(expr `tput lines` - 1 + $scroll)
screencols=$(expr `tput cols` / 2 - 1)
chars=(a b c d e f g h i j k l m n o p q r s t u v w x y z 1 2 3 4 5 6 7 8 9 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) ##请在此处修改你想显示的字符
count=${#chars[@]}
colorcount=${#colors[@]}
trap "tput sgr0; clear; exit" SIGTERM SIGINT
if [[ $1 =~ "-h" ]]
then
echo "display a matrix screen in the terminal"
echo "usage: matrix [SPACING [SCROLL]]"
echo "example: matrix 100 0"
exit 0
fi
clear
tput cup 0 0
while :
do
for i in $(eval echo {1..$screenlines})
do
for i in $(eval echo {1..$screenlines})
do
rand=$(($RANDOM%$spacing))
case $rand in
0)
printf "${colors[$RANDOM%$colorcount]}${chars[$RANDOM%$count]} ";;
1)
printf " ";;
*)
printf "\033[2C";;
esac
done
printf "\n"
done
tput cup 0 0
done执行效果如下:
边栏推荐
猜你喜欢
随机推荐
25 most popular original technical articles of ink sky wheel from January to June 2022
u-boot之顶层Makefile分析(一)
Deploy eshopondapr on Tencent cloud eks
中金财富开户安全吗 开户有什么用
2022年宁德市职业院校教师实践教学能力提升培训——网络搭建与管理
SSM框架+jsp实现的实验室管理系统【源码+数据库+系统论文】
Create a list, add the strings "a", "B", "C", "d" and "d" in turn, and print the contents of the set, then remove all the strings "d" in the list, and print its contents again
二叉树的性质和遍历
High Performance Computing Center - RDMA - NVIDIA sharp
PAT 甲级 A1020 Tree Traversals
机器学习练习 5 - 偏差和方差
2022.07.11
DEDECMS织梦上一篇下一篇自由可控输出链接、标题、缩略图、时间
zabbix 监控服务 (三) 配置管理图形和窗口
Pat grade a a1043 is it a binary search tree
一种新的UI测试方法:视觉感知测试
Migrate MySQL database to Kingbase database (other databases are similar)
理解了Dowanward API的妙用,轻松拿捏kubernetes环境变量
2022年正规期货交易平台的app有哪些,安全吗?
u-boot之顶层Makefile分析(三)









