Skip to content

Commit 2ff14ec

Browse files
committed
rename and add more script
1 parent 430f35b commit 2ff14ec

34 files changed

+109
-32
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/bash
2-
echo .Enter the First Number: .
2+
3+
echo 'Enter the First Number :'
34
read a
4-
echo .Enter the Second Number: .
5+
echo 'Enter the Second Number :'
56
read b
67
x=$(expr "$a" + "$b")
78
echo $a + $b = $x

scripts/affect.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
arr=('-' '|' '/' '-' '\' '|')
4+
while true; do
5+
for c in "${arr[@]}"; do
6+
printf "\r %c " $c
7+
sleep .5
8+
done
9+
done
File renamed without changes.

scripts/Binary2Decimal.sh renamed to scripts/binary2decimal.sh

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ echo "Enter a number :"
33
read Binary
44
if [ $Binary -eq 0 ]; then
55
echo "Enter a valid number "
6+
return
67
else
78
while [ $Binary -ne 0 ]; do
89
Bnumber=$Binary

scripts/Colorfull.sh renamed to scripts/colorfull.sh

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
#!/bin/bash
22

3+
DARKGRAY='\033[1;30m'
4+
RED='\033[0;31m'
5+
LIGHTRED='\033[1;31m'
6+
GREEN='\033[0;32m'
7+
YELLOW='\033[1;33m'
8+
BLUE='\033[0;34m'
9+
PURPLE='\033[0;35m'
10+
LIGHTPURPLE='\033[1;35m'
11+
CYAN='\033[0;36m'
12+
WHITE='\033[1;37m'
13+
SET='\033[0m'
14+
15+
echo "I ${DARKGRAY}love${SET} github."
16+
echo "I ${RED}love${SET} github."
17+
echo "I ${LIGHTRED}love${SET} github."
18+
echo "I ${GREEN}love${SET} github."
19+
echo "I ${YELLOW}love${SET} github."
20+
echo "I ${BLUE}love${SET} github."
21+
echo "I ${PURPLE}love${SET} github."
22+
echo "I ${LIGHTPURPLE}love${SET} github."
23+
echo "I ${CYAN}love${SET} github."
24+
echo "I ${WHITE}love${SET} github."
25+
326
clear
427
echo -e "\033[1m Hello World"
528
# bold effect

scripts/dec2hex.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
printf "0x%x\n" $1
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/hextodec.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
printf "%d \n " $1
File renamed without changes.

scripts/list-dir.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
list=($(ls))
4+
5+
for f in "${list[@]}";do
6+
echo $f
7+
done

scripts/lowercase.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
read -p "Enter String Uppercase : " i
3+
o=$(echo "$i" | tr '[:upper:]' '[:lower:]')
4+
echo $o
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/random-emoji.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
while true; do
4+
rand=$(shuf -i 2600-2700 -n 1)
5+
echo -n -e ' \u'$rand
6+
sleep 1
7+
done
File renamed without changes.

scripts/rang-random.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
shuf -i $1-$2 -n 1
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/traps.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
function finish() {
4+
# your cleanup here.
5+
echo "CTL+C pressed"
6+
echo "clean ..."
7+
sleep 1
8+
}
9+
trap finish EXIT
10+
11+
echo 'runing ...'
12+
until false; do
13+
sleep 1
14+
done
File renamed without changes.

scripts/while-menu.sh

+28-28
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,38 @@
22
# while-menu: a menu driven system information program
33
DELAY=1 # Number of seconds to display results
44
while [[ $REPLY != 0 ]]; do
5-
clear
6-
cat <<_EOF_
5+
clear
6+
cat << EOF
77
Please Select:
88
1. Display System Information
99
2. Display Disk Space
1010
3. Display Home Space Utilization
1111
0. Quit
12-
_EOF_
13-
read -p "Enter selection [0-3] > "
14-
if [[ $REPLY =~ ^[0-3]$ ]]; then
15-
if [[ $REPLY == 1 ]]; then
16-
echo "Hostname: $HOSTNAME"
17-
uptime
18-
sleep $DELAY
19-
fi
20-
if [[ $REPLY == 2 ]]; then
21-
df -h
22-
sleep $DELAY
23-
fi
24-
if [[ $REPLY == 3 ]]; then
25-
if [[ $(id -u) -eq 0 ]]; then
26-
echo "Home Space Utilization (All Users)"
27-
du -sh /home/*
28-
else
29-
echo "Home Space Utilization ($USER)"
30-
du -sh $HOME
31-
fi
32-
sleep $DELAY
33-
fi
34-
else
35-
echo "Invalid entry."
36-
sleep $DELAY
37-
fi
12+
EOF
13+
read -p "Enter selection [0-3] > "
14+
if [[ $REPLY =~ ^[0-3]$ ]]; then
15+
if [[ $REPLY == 1 ]]; then
16+
echo "Hostname: $HOSTNAME"
17+
uptime
18+
sleep $DELAY
19+
fi
20+
if [[ $REPLY == 2 ]]; then
21+
df -h
22+
sleep $DELAY
23+
fi
24+
if [[ $REPLY == 3 ]]; then
25+
if [[ $(id -u) -eq 0 ]]; then
26+
echo "Home Space Utilization (All Users)"
27+
du -sh /home/*
28+
else
29+
echo "Home Space Utilization ($USER)"
30+
du -sh $HOME
31+
fi
32+
sleep $DELAY
33+
fi
34+
else
35+
echo "Invalid entry."
36+
sleep $DELAY
37+
fi
3838
done
3939
echo "Program terminated."

scripts/while-read.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22
# while-read: read lines from a file
3+
count=0
34
while read; do
4-
printf "%s\n" $REPLY
5-
done </etc/passwd
5+
printf "%d %s\n" $REPLY
6+
count=$(expr $count + 1)
7+
done <$1

0 commit comments

Comments
 (0)