当前位置:网站首页>Matrix of shell programming -- it's cute and cool
Matrix of shell programming -- it's cute and cool
2022-07-27 19:09:00 【Finger sword】
The code is as follows :
#!/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) ## Please modify the characters you want to display here
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
doneThe implementation effect is as follows :
边栏推荐
- Day 3 of leetcode question brushing
- Unity display Kinect depth data
- Product recommendation and classified product recommendation
- Nodejs template engine EJS
- Nacos集群部署-高可用保证
- npm 基本使用
- Mini washing machine touch chip dlt8ma12ts Jericho
- Electromagnetic field learning notes - vector analysis and field theory foundation
- `this.$emit` 子组件给父组件传递多个参数
- Using MATLAB to generate graphics for journals and conferences - plot
猜你喜欢
随机推荐
JDBC MySQL 02 data access and Dao mode
ES6学习笔记(1)——快速入门
SQL server stored procedures multi angle introduction suggestions collection
Self control principle learning notes - system stability analysis (2) - loop analysis and Nyquist bode criterion
An article allows you to master threads and thread pools, and also solves thread safety problems. Are you sure you want to take a look?
asp.net 的经验
Day 3 of leetcode question brushing
Collection of software design suggestions of "high cohesion and low coupling"
Performance analysis of continuous time system (1) - performance index and first and second order analysis of control system
C interface knowledge collection suggestions collection
WORD 2007+使用技巧
[wechat applet] project practice - lottery application
Low noise anion fan touch IC
PHP string operation
MySQL 05 stored procedure
MySQL学习笔记(2)——存储过程与存储函数
npm 基本使用
ref 关键字的用法
收下这份实操案例,还怕不会用Jmeter接口测试工具
Nacos的基本使用(1)——入门








