Skip to content

Commit 92c70b4

Browse files
practice
0 parents  commit 92c70b4

File tree

19 files changed

+188
-0
lines changed

19 files changed

+188
-0
lines changed

a1.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
for i in 1 2 3 4 5
3+
do
4+
echo "$i"
5+
done

a2.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
for i in 1 2 3 4 5
3+
do
4+
{
5+
echo -e "\033[32m Hello$i \033[0m"
6+
}
7+
done
8+

abc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
facebook.com
2+
instagram.com
3+
172.31.0.28
4+
192.168.1.1
5+
192.168.1.2
6+
192.168.1.13

diskscript.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
disk=`df -kh | sed -n '5p' | awk '{print $5}' | cut -d% -f 1`
3+
if [ $disk -ge 35 ]
4+
then
5+
echo "disk is in critical face!" | mail -s "check disk space" root@localhost
6+
else
7+
echo "OKAY"
8+
fi

even.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
for i in {1..20..2}
3+
do
4+
echo "even numbers are = $i"
5+
done

example-1.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
read -p "which IP you want to ping : " a
3+
ping -c1 $a >> /dev/null
4+
if [ $? = 0 ]
5+
then
6+
echo "$a IP is up"
7+
else
8+
echo "$a IP is down"
9+
fi

example-2.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
for i in {1..10..1}
3+
do
4+
echo "It is $i/10 ."
5+
done

example-3.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
read -p "enter a file name : " i
3+
xyz=`cat $i | wc -l`
4+
file () {
5+
echo The file $i has $xyz lines in it.
6+
}
7+
file

memcache.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
a=`free -h | grep -i mem | awk '{print $4}'`
3+
b=`free -h | grep -i mem | awk '{print $7}'`
4+
echo "free space is = $a and available is = $b !"

ping.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
x=`cat abc`
3+
for i in $x
4+
do
5+
ping -c2 $i >> /dev/null
6+
if [ $? = 0 ]
7+
then
8+
echo "$i is up"
9+
else
10+
echo "$i is down"
11+
fi
12+
done

0 commit comments

Comments
 (0)