Skip to content

Commit 24ea39b

Browse files
committed
first commit
0 parents  commit 24ea39b

26 files changed

+527
-0
lines changed

Addition.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
echo .Enter the First Number: .
3+
read a
4+
echo .Enter the Second Number: .
5+
read b
6+
x=$(expr "$a" + "$b")
7+
echo $a + $b = $x
8+

Armstrong.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
echo "Enter A Number"
3+
read n
4+
arm=0
5+
temp=$n
6+
while [ $n -ne 0 ]
7+
do
8+
r=$(expr $n % 10)
9+
arm=$(expr $arm + $r \* $r \* $r)
10+
n=$(expr $n / 10)
11+
done
12+
echo $arm
13+
if [ $arm -eq $temp ]
14+
then
15+
echo "Armstrong"
16+
else
17+
echo "Not Armstrong"
18+
fi
19+
20+

Binary2Decimal.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
echo "Enter a number :"
3+
read Binary
4+
if [ $Binary -eq 0 ]
5+
then
6+
echo "Enter a valid number "
7+
else
8+
while [ $Binary -ne 0 ]
9+
do
10+
Bnumber=$Binary
11+
Decimal=0
12+
power=1
13+
while [ $Binary -ne 0 ]
14+
do
15+
rem=$(expr $Binary % 10 )
16+
Decimal=$((Decimal+(rem*power)))
17+
power=$((power*2))
18+
Binary=$(expr $Binary / 10)
19+
done
20+
echo " $Decimal"
21+
done
22+
fi

Check-Disk-Space.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
MAX=95
2+
3+
PART=sda1
4+
5+
USE=`df -h |grep $PART | awk '{ print $5 }' | cut -d'%' -f1`
6+
if [ $USE -gt $MAX ]; then
7+
echo "Percent used: $USE" | mail -s "Running out of disk space" $EMAIL
8+
fi

Colorfull.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
clear
4+
echo -e "\033[1m Hello World"
5+
# bold effect
6+
echo -e "\033[5m Blink"
7+
# blink effect
8+
echo -e "\033[0m Hello World"
9+
# back to noraml
10+
11+
echo -e "\033[31m Hello World"
12+
# Red color
13+
echo -e "\033[32m Hello World"
14+
# Green color
15+
echo -e "\033[33m Hello World"
16+
# See remaing on screen
17+
echo -e "\033[34m Hello World"
18+
echo -e "\033[35m Hello World"
19+
echo -e "\033[36m Hello World"
20+
21+
echo -e -n "\033[0m"
22+
# back to noraml
23+
echo -e "\033[41m Hello World"
24+
echo -e "\033[42m Hello World"
25+
echo -e "\033[43m Hello World"
26+
echo -e "\033[44m Hello World"
27+
echo -e "\033[45m Hello World"
28+
echo -e "\033[46m Hello World"
29+
30+
31+
echo -e "\033[0m Hello World"
32+

Decimal2Binary.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
for ((i=32;i>=0;i--)); do
4+
r=$(( 2**$i))
5+
Probablity+=( $r )
6+
done
7+
8+
[[ $# -eq 0 ]] && { echo -e "Usage \n \t $0 numbers"; exit 1; }
9+
10+
echo -en "Decimal\t\tBinary\n"
11+
for input_int in $@; do
12+
s=0
13+
test ${#input_int} -gt 11 && { echo "Support Upto 10 Digit number :: skiping \"$input_int\""; continue; }
14+
15+
printf "%-10s\t" "$input_int"
16+
17+
for n in ${Probablity[@]}; do
18+
19+
if [[ $input_int -lt ${n} ]]; then
20+
[[ $s = 1 ]] && printf "%d" 0
21+
else
22+
printf "%d" 1 ; s=1
23+
input_int=$(( $input_int - ${n} ))
24+
fi
25+
done
26+
echo -e
27+
done

Division.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
echo .Enter the First Number: .
3+
read a
4+
echo .Enter the Second Number: .
5+
read b
6+
echo "$a / $b = $(expr $a / $b)"
7+
8+

Encrypt.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
echo "Welcome, I am ready to encrypt a file/folder for you"
3+
echo "currently I have a limitation, Place me to teh same folder, where a file to be encrypted is present"
4+
echo "Enter the Exact File Name with extension"
5+
read file;
6+
gpg -c $file
7+
echo "I have encrypted the file sucessfully..."
8+
echo "Now I will be removing the original file"
9+
rm -rf $file

EvenOdd.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
echo "Enter The Number"
3+
read n
4+
num=$(expr $n % 2)
5+
if [ $num -eq 0 ]
6+
then
7+
echo "is a Even Number"
8+
else
9+
echo "is a Odd Number"
10+
fi
11+
12+

Factorial.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
echo "Enter The Number"
3+
read a
4+
fact=1
5+
while [ $a -ne 0 ]
6+
do
7+
fact=$(expr $fact \* $a)
8+
a=$(expr $a - 1)
9+
done
10+
echo $fact
11+
12+

0 commit comments

Comments
 (0)