Linux World
Pages
Home
Programming
Computer Architecture
Tit Bits
Trouble Shoot
Kernel Related
Quizzes
Linux Tips
Follow @Linux_world
Search
Create animated 2019 on terminal
The above animation can be generated on the termnal using the following script.
#!/bin/bash #create 2017 on terminal using any user specified character str_dwn() { rows=$1 s_start=$2 char=$4 str_st_row=$3 rows_end=$((str_st_row+rows)) for((i=str_st_row;i<rows_end;i++)) do tput cup $i $s_start printf "$char " done echo"" } backslash() { b_st_row=$1 b_st_cols=$2 b_char=$3 b_r_end=$((b_st_row + 5 )) for((p=b_st_row;p<b_r_end;p++)) do tput setaf $4 tput cup $p $b_st_cols printf "$b_char " ((b_st_cols++)) done echo"" } forward() { f_st_row=$1 f_st_cols=$2 f_len=$3 f_char=$4 f_r_end=$((f_st_row + $f_len)) for((i=f_st_row;i<f_r_end;i++)) do tput cup $i $f_st_cols printf "$f_char " ((f_st_cols--)) done echo"" } horizontal() { hrow=$2 hstart=$1 hcols=$3 char=$4 end=$((hstart + hcols)) for((i=hstart;i<=end;i++)) do tput cup $hrow $i printf "$char" done echo"" } half_horizontal() { hrow=$2 hstart=$1 hcols=$(($3/2)) char=$4 end=$((hstart + hcols)) for((i=hstart;i<=end;i++)) do tput cup $hrow $i printf "$char" done echo"" } gen_rand() { num1=$1 if [ $num1 -eq 0 ] then temp=$(($RANDOM % 2)) rand=$((temp + 2)) else temp=$(($RANDOM % 5)) rand=$((temp + num1)) fi } two() { hstart_2=$1 hrow_be=$2 hcols_2=$3 char=$4 color=$5 set_color horizontal $hstart_2 $hrow_be $hcols_2 "$char" st_row_2=$((hrow_be+1)) f_st_cols_2=$((hstart_2+hcols_2)) forward $st_row_2 $f_st_cols_2 5 "$char" $color hstart_2_lo=$start hrow_2_lo=$((hrow_be+6)) hcols_2_lo=5 horizontal $hstart_2_lo $hrow_2_lo $hcols_2_lo "$char" } zero() { set_color hstart_0=$((f_st_cols_2 +4)) hcols_0=5 horizontal $hstart_0 $hrow_be $hcols_0 "$char" str_dwn_col_0=$hstart_0 str_dwn_row_0=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_0 $str_dwn_row_0 "$char" hstart_0_lo=$((f_st_cols_2 +4)) hcols_0_lo=6 hrow_0_lo=$((hrow_be+6)) horizontal $hstart_0 $hrow_0_lo $hcols_0 "$char" str_dwn_col_rig_0=$((hstart_0 +5)) str_dwn_row_rig_0=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_rig_0 $str_dwn_row_rig_0 "$char" } one() { set_color str_dwn_col_1=$((str_dwn_col_rig_0 + 4)) str_dwn_row_1=$((hrow_be)) str_dwn 7 $str_dwn_col_1 $str_dwn_row_1 "$char" } nine() { set_color set_color hstart_8=$((str_dwn_col_1 +4)) hcols_8=5 horizontal $hstart_8 $hrow_be $hcols_8 "$char" str_dwn_col_8=$hstart_8 str_dwn_row_8=$((hrow_be + 1)) str_dwn 3 $str_dwn_col_8 $str_dwn_row_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+6)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" str_dwn_col_rig_8=$((hstart_8 +5)) str_dwn_row_rig_8=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_rig_8 $str_dwn_row_rig_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+3)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" } five() { set_color set_color #hstart_8=$((str_dwn_col_1 +4)) #hcols_8=5 #horizontal $hstart_8 $hrow_be $hcols_8 "$char" str_dwn_col_8=$hstart_8 str_dwn_row_8=$((hrow_be + 1)) str_dwn 3 $str_dwn_col_8 $str_dwn_row_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+6)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" str_dwn_col_rig_8=$((hstart_8 +5)) str_dwn_row_rig_8=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_rig_8 $str_dwn_row_rig_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+3)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" } set_color(){ color=$RANDOM color=$((color%6)) tput setaf $color } cols=`tput cols` mid=$((cols/2)) start=$((mid-16)) #echo "What character do you want to use" #read char char="*" tput clear rows=5 begin_row=2 num_cols=6 two $start $begin_row $num_cols "$char" $color;zero;one;nine tput setaf 7 tput cup 9 0
Save the script as 2019.sh and run on the terminal to generate the animation.
Create a countdown to 2019
Save the following script as countdown2019.sh
str_dwn() { rows=$1 s_start=$2 char=$4 str_st_row=$3 rows_end=$((str_st_row+rows)) for((i=str_st_row;i<rows_end;i++)) do tput cup $i $s_start printf "$char " done echo"" } backslash() { b_st_row=$1 b_st_cols=$2 b_char=$3 b_r_end=$((b_st_row + 5 )) for((p=b_st_row;p<b_r_end;p++)) do tput setaf $4 tput cup $p $b_st_cols printf "$b_char " ((b_st_cols++)) done echo"" } forward() { f_st_row=$1 f_st_cols=$2 f_len=$3 f_char=$4 f_r_end=$((f_st_row + $f_len)) for((i=f_st_row;i<f_r_end;i++)) do tput cup $i $f_st_cols printf "$f_char " ((f_st_cols--)) done echo"" } horizontal() { hrow=$2 hstart=$1 hcols=$3 char=$4 end=$((hstart + hcols)) for((i=hstart;i<=end;i++)) do tput cup $hrow $i printf "$char" done echo"" } half_horizontal() { hrow=$2 hstart=$1 hcols=$(($3/2)) char=$4 end=$((hstart + hcols)) for((i=hstart;i<=end;i++)) do tput cup $hrow $i printf "$char" done echo"" } gen_rand() { num1=$1 if [ $num1 -eq 0 ] then temp=$(($RANDOM % 2)) rand=$((temp + 2)) else temp=$(($RANDOM % 5)) rand=$((temp + num1)) fi } two() { hstart_2=$1 hrow_be=$2 hcols_2=$3 char=$4 color=$5 set_color horizontal $hstart_2 $hrow_be $hcols_2 "$char" st_row_2=$((hrow_be+1)) f_st_cols_2=$((hstart_2+hcols_2)) forward $st_row_2 $f_st_cols_2 5 "$char" $color hstart_2_lo=$start hrow_2_lo=$((hrow_be+6)) hcols_2_lo=5 horizontal $hstart_2_lo $hrow_2_lo $hcols_2_lo "$char" } zero() { set_color hstart_0=$((f_st_cols_2 +4)) hcols_0=5 horizontal $hstart_0 $hrow_be $hcols_0 "$char" str_dwn_col_0=$hstart_0 str_dwn_row_0=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_0 $str_dwn_row_0 "$char" hstart_0_lo=$((f_st_cols_2 +4)) hcols_0_lo=6 hrow_0_lo=$((hrow_be+6)) horizontal $hstart_0 $hrow_0_lo $hcols_0 "$char" str_dwn_col_rig_0=$((hstart_0 +5)) str_dwn_row_rig_0=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_rig_0 $str_dwn_row_rig_0 "$char" } one() { set_color str_dwn_col_1=$((str_dwn_col_rig_0 + 4)) str_dwn_row_1=$((hrow_be)) str_dwn 7 $str_dwn_col_1 $str_dwn_row_1 "$char" } nine() { set_color set_color hstart_8=$((str_dwn_col_1 +4)) hcols_8=5 horizontal $hstart_8 $hrow_be $hcols_8 "$char" str_dwn_col_8=$hstart_8 str_dwn_row_8=$((hrow_be + 1)) str_dwn 3 $str_dwn_col_8 $str_dwn_row_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+6)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" str_dwn_col_rig_8=$((hstart_8 +5)) str_dwn_row_rig_8=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_rig_8 $str_dwn_row_rig_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+3)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" } six() { set_color set_color hstart_8=$((str_dwn_col_1 +4)) hcols_8=5 horizontal $hstart_8 $hrow_be $hcols_8 "$char" str_dwn_col_8=$hstart_8 str_dwn_row_8=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_8 $str_dwn_row_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+6)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" str_dwn_col_rig_8=$((hstart_8 +5)) str_dwn_row_rig_8=$((hrow_be + 1+3)) str_dwn 3 $str_dwn_col_rig_8 $str_dwn_row_rig_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+3)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" } seven() { set_color hstart_7_top=$((str_dwn_col_1 +4)) hcols_7_top=4 hrow_7_top=$((hrow_be)) horizontal $hstart_7_top $hrow_7_top $hcols_7_top "$char" hstart_7_mid=$((str_dwn_col_1+8)) hcols_7_mid=4 hrow_7_mid=$((hrow_be)) forward $hrow_7_mid $hstart_7_mid 7 "$char" $color } eight() { set_color set_color hstart_8=$((str_dwn_col_1 +4)) hcols_8=5 horizontal $hstart_8 $hrow_be $hcols_8 "$char" str_dwn_col_8=$hstart_8 str_dwn_row_8=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_8 $str_dwn_row_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+6)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" str_dwn_col_rig_8=$((hstart_8 +5)) str_dwn_row_rig_8=$((hrow_be + 1)) str_dwn 6 $str_dwn_col_rig_8 $str_dwn_row_rig_8 "$char" hstart_8_lo=$((f_st_cols_2 +4)) hcols_8_lo=6 hrow_8_lo=$((hrow_be+3)) horizontal $hstart_8 $hrow_8_lo $hcols_8 "$char" } set_color(){ color=$RANDOM color=$((color%6)) tput setaf $color } cols=`tput cols` mid=$((cols/2)) start=$((mid-16)) #echo "What character do you want to use" #read char char="*" tput clear rows=5 begin_row=2 num_cols=6 two $start $begin_row $num_cols "$char" $color;zero;one;six sleep 2 tput clear two $start $begin_row $num_cols "$char" $color;zero;one;seven sleep 2 tput clear two $start $begin_row $num_cols "$char" $color;zero;one;eight sleep 2 tput clear two $start $begin_row $num_cols "$char" $color;zero;one;nine tput setaf 7 tput cup 9 0
Run the script as
bash countdown2019.sh
It should generate a countup from 2016,2017,2018 and 2019 on the terminal with random colors made up of *.
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)