Skip to content

Commit

Permalink
Adding Scripts in #1 (#8)
Browse files Browse the repository at this point in the history
* created fancy/ and added two scripts in it

* added chmod +x fancy/*

---------

Co-authored-by: sarthak ganure <[email protected]>
  • Loading branch information
SaRTHaK0909k and sarthak ganure authored Oct 16, 2023
1 parent 6aa1acc commit 30e754e
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
36 changes: 36 additions & 0 deletions fancy/night_sky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Define colors
blue='\e[1;34m'
yellow='\e[1;93m'
reset='\e[0m'

# Function to draw stars
draw_stars() {
for i in {1..30}; do
x=$((RANDOM % $(tput lines)))
y=$((RANDOM % $(tput cols)))
tput cup $x $y
echo -en "${yellow}*"
done
}

# Function to display starry sky
display_starry_sky() {
clear
draw_stars
sleep 1
}

# Main function
main() {
for i in {1..10}; do
display_starry_sky
done

tput cup $(tput lines) 0
}

# Calling the main function
main

41 changes: 41 additions & 0 deletions fancy/rainbow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Define colors
red='\e[1;31m'
orange='\e[1;33m'
yellow='\e[1;93m'
green='\e[1;32m'
blue='\e[1;34m'
indigo='\e[1;94m'
violet='\e[1;35m'
reset='\e[0m'

# Rainbow colors array
colors=($red $orange $yellow $green $blue $indigo $violet)

# Function to draw rainbow line
draw_rainbow_line() {
for color in "${colors[@]}"; do
echo -en "$color#####"
sleep 0.1
done
echo -e "$reset"
}

# Function to draw the rainbow
draw_rainbow() {
clear
for i in {1..7}; do
draw_rainbow_line
sleep 0.1
done
}

# Main function
main() {
draw_rainbow
echo "Rainbow has been drawn!"
}

# Calling the main function
main

0 comments on commit 30e754e

Please sign in to comment.