Skip to content

Commit 604a47e

Browse files
author
NarendraPAutomationEngineer
committed
updated documents
1 parent 675aa49 commit 604a47e

File tree

34 files changed

+295
-13
lines changed

34 files changed

+295
-13
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Git Repo url is: https://github.com/NarendraPAutomationEngineer/BashShellScriptingTutorials
2+
3+
Open git bash/linux terminal and run below command to download repo:
4+
5+
git clone https://github.com/NarendraPAutomationEngineer/BashShellScriptingTutorials.git
6+
7+
Note: Above command will download BashShellScriptingTutorials repo

1.Introduction/3.StepsToConfigureGmailOnUbuntuServer.txt 1.Introduction/4. Steps to Configure Gmail on Ubuntu server to send mails.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ Step8: Now open https://www.google.com/settings/security/lesssecureapps
3737
Step9: Verify the test mail using
3838
echo "Demo" | mail -s "Status of Httpd" [email protected]
3939

40-
echo "Demo" | mail -s "Status of Httpd" [email protected] -A demo.txt
40+
echo "Demo" | mail -s "Status of Httpd" [email protected] -A demo.txt

1.Introduction/sendDockerNgninxVersionsReport.sh

-12
This file was deleted.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Reset
2+
Color_Off='\033[0m' # Text Reset
3+
4+
# Regular Colors
5+
Black='\033[0;30m' # Black
6+
Red='\033[0;31m' # Red
7+
Green='\033[0;32m' # Green
8+
Yellow='\033[0;33m' # Yellow
9+
Blue='\033[0;34m' # Blue
10+
Purple='\033[0;35m' # Purple
11+
Cyan='\033[0;36m' # Cyan
12+
White='\033[0;37m' # White
13+
14+
# Bold
15+
BBlack='\033[1;30m' # Black
16+
BRed='\033[1;31m' # Red
17+
BGreen='\033[1;32m' # Green
18+
BYellow='\033[1;33m' # Yellow
19+
BBlue='\033[1;34m' # Blue
20+
BPurple='\033[1;35m' # Purple
21+
BCyan='\033[1;36m' # Cyan
22+
BWhite='\033[1;37m' # White
23+
24+
# Underline
25+
UBlack='\033[4;30m' # Black
26+
URed='\033[4;31m' # Red
27+
UGreen='\033[4;32m' # Green
28+
UYellow='\033[4;33m' # Yellow
29+
UBlue='\033[4;34m' # Blue
30+
UPurple='\033[4;35m' # Purple
31+
UCyan='\033[4;36m' # Cyan
32+
UWhite='\033[4;37m' # White
33+
34+
# Background
35+
On_Black='\033[40m' # Black
36+
On_Red='\033[41m' # Red
37+
On_Green='\033[42m' # Green
38+
On_Yellow='\033[43m' # Yellow
39+
On_Blue='\033[44m' # Blue
40+
On_Purple='\033[45m' # Purple
41+
On_Cyan='\033[46m' # Cyan
42+
On_White='\033[47m' # White
43+
44+
# High Intensity
45+
IBlack='\033[0;90m' # Black
46+
IRed='\033[0;91m' # Red
47+
IGreen='\033[0;92m' # Green
48+
IYellow='\033[0;93m' # Yellow
49+
IBlue='\033[0;94m' # Blue
50+
IPurple='\033[0;95m' # Purple
51+
ICyan='\033[0;96m' # Cyan
52+
IWhite='\033[0;97m' # White
53+
54+
# Bold High Intensity
55+
BIBlack='\033[1;90m' # Black
56+
BIRed='\033[1;91m' # Red
57+
BIGreen='\033[1;92m' # Green
58+
BIYellow='\033[1;93m' # Yellow
59+
BIBlue='\033[1;94m' # Blue
60+
BIPurple='\033[1;95m' # Purple
61+
BICyan='\033[1;96m' # Cyan
62+
BIWhite='\033[1;97m' # White
63+
64+
# High Intensity backgrounds
65+
On_IBlack='\033[0;100m' # Black
66+
On_IRed='\033[0;101m' # Red
67+
On_IGreen='\033[0;102m' # Green
68+
On_IYellow='\033[0;103m' # Yellow
69+
On_IBlue='\033[0;104m' # Blue
70+
On_IPurple='\033[0;105m' # Purple
71+
On_ICyan='\033[0;106m' # Cyan
72+
On_IWhite='\033[0;107m' # White
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Reset
2+
Color_Off='\033[0m' # Text Reset
3+
4+
# Regular Colors
5+
Black='\033[0;30m' # Black
6+
Red='\033[0;31m' # Red
7+
Green='\033[0;32m' # Green
8+
Yellow='\033[0;33m' # Yellow
9+
Blue='\033[0;34m' # Blue
10+
Purple='\033[0;35m' # Purple
11+
Cyan='\033[0;36m' # Cyan
12+
White='\033[0;37m' # White
13+
14+
# Bold
15+
BBlack='\033[1;30m' # Black
16+
BRed='\033[1;31m' # Red
17+
BGreen='\033[1;32m' # Green
18+
BYellow='\033[1;33m' # Yellow
19+
BBlue='\033[1;34m' # Blue
20+
BPurple='\033[1;35m' # Purple
21+
BCyan='\033[1;36m' # Cyan
22+
BWhite='\033[1;37m' # White
23+
24+
# Underline
25+
UBlack='\033[4;30m' # Black
26+
URed='\033[4;31m' # Red
27+
UGreen='\033[4;32m' # Green
28+
UYellow='\033[4;33m' # Yellow
29+
UBlue='\033[4;34m' # Blue
30+
UPurple='\033[4;35m' # Purple
31+
UCyan='\033[4;36m' # Cyan
32+
UWhite='\033[4;37m' # White
33+
34+
# Background
35+
On_Black='\033[40m' # Black
36+
On_Red='\033[41m' # Red
37+
On_Green='\033[42m' # Green
38+
On_Yellow='\033[43m' # Yellow
39+
On_Blue='\033[44m' # Blue
40+
On_Purple='\033[45m' # Purple
41+
On_Cyan='\033[46m' # Cyan
42+
On_White='\033[47m' # White
43+
44+
# High Intensity
45+
IBlack='\033[0;90m' # Black
46+
IRed='\033[0;91m' # Red
47+
IGreen='\033[0;92m' # Green
48+
IYellow='\033[0;93m' # Yellow
49+
IBlue='\033[0;94m' # Blue
50+
IPurple='\033[0;95m' # Purple
51+
ICyan='\033[0;96m' # Cyan
52+
IWhite='\033[0;97m' # White
53+
54+
# Bold High Intensity
55+
BIBlack='\033[1;90m' # Black
56+
BIRed='\033[1;91m' # Red
57+
BIGreen='\033[1;92m' # Green
58+
BIYellow='\033[1;93m' # Yellow
59+
BIBlue='\033[1;94m' # Blue
60+
BIPurple='\033[1;95m' # Purple
61+
BICyan='\033[1;96m' # Cyan
62+
BIWhite='\033[1;97m' # White
63+
64+
# High Intensity backgrounds
65+
On_IBlack='\033[0;100m' # Black
66+
On_IRed='\033[0;101m' # Red
67+
On_IGreen='\033[0;102m' # Green
68+
On_IYellow='\033[0;103m' # Yellow
69+
On_IBlue='\033[0;104m' # Blue
70+
On_IPurple='\033[0;105m' # Purple
71+
On_ICyan='\033[0;106m' # Cyan
72+
On_IWhite='\033[0;107m' # White
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
dockerStatus=$(systemctl status docker | awk '/Active/ { print $3 }' | tr -d "[()]")
3+
dockerVersion=$(docker -v | awk '/version/ { print $3 }' | tr -d ",")
4+
echo "The Docker Status is: $dockerStatus"
5+
echo "The Docker version is: $dockerVersion"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/bash
2+
<< mycom
3+
read -p "Enter your name: " my_name
4+
my_name_up=${my_name^^}
5+
echo "Your name in upper-case is: $my_name_up"
6+
mycom
7+
8+
read -p "Enter your name: "
9+
echo "$REPLY"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/bash
2+
<< mycom
3+
echo "$0"
4+
echo "$1"
5+
echo "$2"
6+
echo "$3"
7+
echo "${10}"
8+
mycom
9+
10+
echo "The number command line arguments: $#"
11+
echo "All command line arguments are: $*"
12+
echo "All command line arguments are: $@"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Arithmetic Operators:
2+
====================
3+
Addition +
4+
Subtraction -
5+
Multiplication *
6+
Division /
7+
Remainder %
8+
Increment ++ (To increment your value by one; example if x=2 then ((x++)) means x value will increase by 1 and it is 3 now.
9+
Decrement --
10+
If your data is integers then use (()) syntax to perform arithmetic operations else use bc (bash calculator).
11+
12+
Integer Example:
13+
x=4
14+
y=7
15+
((sum=x+y))
16+
echo "The addition of $x and $y is: $sum"
17+
Float/integer Example:
18+
Note: bc calculator is a commmand to perform arithemtic operations on either integers or float numbers.
19+
x=4.5
20+
y=6.7
21+
sum=$(bc<<<"scale=3;$x+$y")
22+
echo "The addtion of $x and $y is: $sum"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/bash
2+
read -p "Enter any number: " num
3+
case $num in
4+
[0-9])
5+
echo "you enterd single number"
6+
;;
7+
[a-z])
8+
echo "you entered lower case alph"
9+
;;
10+
[A-Z])
11+
echo "you enterd upper case alph"
12+
;;
13+
*)
14+
echo "Unable to identify your input"
15+
;;
16+
17+
esac
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/bash
2+
clear
3+
read -p "Enter your file extention: " ext
4+
case $ext in
5+
".txt")
6+
ls -lrt *.txt
7+
;;
8+
".sh")
9+
ls -lrt *.sh
10+
;;
11+
*)
12+
echo "Sorry!. You entered invalid file extention"
13+
;;
14+
esac
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/bash
2+
clear
3+
read -p "Enter num-1: " a
4+
read -p "Enter num-2: " b
5+
echo "========================="
6+
echo "Enter 1. Addition"
7+
echo " 2. Sub"
8+
echo " 3. Mul"
9+
echo " 4. Div"
10+
echo "========================="
11+
read -p "Enter your option(1-4): " opt
12+
13+
case $opt in
14+
1)
15+
echo "The addition of $a and $b is: $((a+b))"
16+
;;
17+
2)
18+
echo "The sub of $a and $b is: $((a-b))"
19+
;;
20+
3)
21+
echo "The mul of $a and $b is: $((a*b))"
22+
;;
23+
4) echo "The div of $a with $b is: $((a/b))"
24+
;;
25+
*)
26+
echo "Your entered invalid option"
27+
;;
28+
29+
esac
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
File test operators:
2+
--------------------
3+
4+
[ -d file ] -- It return true if the file/path is directory else false
5+
[ -f file ] -- It return true if the file/path is a file else false
6+
[ -e file ] -- It return true if the file/path is exists else false
7+
[ -r file ] -- It return true if the file/path is readable else false
8+
[ -w file ] -- It return true if the file/path is writable else false
9+
[ -x file ] -- It return true if the file/path is executable else false
10+
11+
-----------------------------------------------------------------------------
12+
Advanced file test operators are listed below:
13+
14+
a : True if the file exists.
15+
b : True if the file exists and is a block special file.
16+
c : True if the file exists and is a character special file.
17+
d : True if the file exists and is a directory.
18+
e : True if the file exists.
19+
f : True if the file exists and is a regular file.
20+
g : True if the file exists and its SGID bit is set.
21+
h : True if the file exists and is a symbolic link.
22+
k : True if the file exists and its sticky bit is set.
23+
p : True if the file exists and is a named pipe (FIFO).
24+
r : True if the file exists and is readable.
25+
s : True if the file exists and has a size greater than zero.
26+
t : True if file descriptor is open and refers to a terminal.
27+
u : True if the file exists and its SUID (set user ID) bit is set.
28+
w : True if the file exists and is writable.
29+
x : True if the file exists and is executable.
30+
O : True if the file exists and is owned by the effective user ID.
31+
G : True if the file exists and is owned by the effective group ID.
32+
L : True if the file exists and is a symbolic link.
33+
N : True if the file exists and has been modified since it was last read.
34+
S : True if the file exists and is a socket.
35+
==============================================================================
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)