Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SkwalExe committed Mar 23, 2022
1 parent 0595d64 commit 464fddb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions mini-matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# Author : SkwalExe
# Github : https://github.com/SkwalExe

command="matrix"
command="matrix" # the command to execute

# settings
loop="true"
speed="0.5"
speed="0.5" # delay between each lines
n_chars=10 # number of characters in each line
custom_chars="01"

Expand All @@ -26,12 +26,12 @@ while [ $# -gt 0 ]; do
;;

-s|--speed)
if [ $# -gt 1 ]; then
if [ $(echo "$2" | grep -E "^[0-9]+$") ]; then
if [ $# -gt 1 ]; then # if one argument is specified after --speed
if [ $(echo "$2" | grep -E "^[0-9]+$") ]; then # if the arg is a number
speed=$2
shift 2
elif
[ $(echo "$2" | grep -E "^[0-9]+\.[0-9]+$") ];
[ $(echo "$2" | grep -E "^[0-9]+\.[0-9]+$") ]; # if the arg is a float
then
speed=$2
shift 2
Expand All @@ -48,8 +48,8 @@ while [ $# -gt 0 ]; do

-l|--loop)

if [ $# -gt 1 ]; then
if [ $(echo "$2" | grep -E "^(true|false)$") ]; then
if [ $# -gt 1 ]; then # if there is one argument after --loop
if [ $(echo "$2" | grep -E "^(true|false)$") ]; then # if the arg is true or false
loop=$2
shift 2
else
Expand All @@ -65,8 +65,8 @@ while [ $# -gt 0 ]; do

-c|--chars)

if [ $# -gt 1 ]; then
if [ $(echo "$2" | grep -E "^[0-9]+$") ]; then
if [ $# -gt 1 ]; then # if there is one argument after --chars
if [ $(echo "$2" | grep -E "^[0-9]+$") ]; then # if the arg is a number
n_chars=$2
shift 2
else
Expand All @@ -83,7 +83,7 @@ while [ $# -gt 0 ]; do

-a|--custom-chars)

if [ $# -gt 1 ]; then
if [ $# -gt 1 ]; then # if there is one argument after --custom-chars
custom_chars=$2
shift 2

Expand Down

0 comments on commit 464fddb

Please sign in to comment.