Skip to content

Commit c9812a6

Browse files
authored
Shell Script Tutorial Sample Files
1 parent 5da97e7 commit c9812a6

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed

example1.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
echo "This is my First Shell Script"

example2.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
NAME="VIJAY"
4+
5+
echo "Hello Mr ${NAME}"

example3.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
#This is first variable declaration
4+
NAME="vijay"
5+
6+
#This is second variable
7+
Name="Pater"
8+
9+
#This is Third variable
10+
name="james"
11+
12+
#Print NAME Variable
13+
echo "My Name is ${NAME}"
14+
15+
#Print Name variable
16+
echo "My Name is ${Name}"
17+
18+
#Print name variable
19+
echo "My name is ${name}"

example4.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
#This is script use for getting system information
4+
5+
#Script start here
6+
echo "Script Begain here:::"
7+
8+
#Current date of system
9+
date
10+
11+
#Display Hostname of system
12+
hostname
13+
14+
#Display Kernel information
15+
uname -r
16+
uname -m
17+
18+
#Display Disk Utilization
19+
df -h
20+
21+
#Display memory Utilization
22+
free -h
23+
24+
#Script Ends here
25+
echo "script completed"

loop.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
username=$(whoami)
4+
echo $username
5+
6+
if [[ "${username}" == "root" ]]:
7+
then
8+
echo " you are root user"
9+
else
10+
echo "you are not root user"
11+
fi

0 commit comments

Comments
 (0)