Skip to content

Commit 005ca08

Browse files
authored
Add files via upload
1 parent c585ef4 commit 005ca08

16 files changed

+230
-0
lines changed

04-user_defined_vars.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
#title :
3+
#description :
4+
#author :myLANDMARK.tech S Legah
5+
#date :08112012
6+
#version :1.0
7+
#Tel :437 215 2483
8+
9+
name="Simon Legah"
10+
id=08112012
11+
12+
echo "The name varibale value is: "$name
13+
echo "The id variable value is: "$id
14+
15+

05-command_line_args1.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
#title :
3+
#description :
4+
#author :myLANDMARK.tech S Legah
5+
#date :08112012
6+
#version :1.0
7+
#Tel :437 215 2483
8+
9+
10+
#Number of arguments on the command line.
11+
echo '$#:' $#
12+
#Process number of the current process.
13+
echo '$$:' $$
14+
#Display the 3rd argument on the command line, from left to right.
15+
echo '$3:' $3
16+
#Display the 10th argument on the command line, from left to right.
17+
echo '${10}:' ${10}
18+
#Display the name of the current shell or program.
19+
echo '$0:' $0
20+
#Display all the arguments on the command line using * symbol.
21+
echo '$*:' $*
22+
#Display all the arguments on the command line using @ symbol.
23+
echo '$@:' $@
24+
date
25+
echo '$?:' $?

05-command_line_args2.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
#title :
3+
#description :
4+
#author :myLANDMARK.tech S Legah
5+
#date :08112012
6+
#version :1.0
7+
#Tel :437 215 2483
8+
9+
#if (( $# >= 3 ))
10+
#if [ $# -gt 3 ]
11+
#if [ $# -lt 3 ]
12+
if (( $# == 3 ))
13+
then
14+
#Number of arguments on the command line.
15+
echo '$#:' $#
16+
#Process number of the current process.
17+
echo '$$:' $$
18+
#Display the 3rd argument on the command line, from left to right.
19+
echo '$3:' $3
20+
#Display the 10th argument on the command line, from left to right.
21+
echo '${10}:' ${10}
22+
#Display the name of the current shell or program.
23+
echo '$0:' $0
24+
#Display all the arguments on the command line using * symbol.
25+
echo '$*:' $*
26+
#Display all the arguments on the command line using @ symbol.
27+
echo '$@:' $@
28+
date
29+
echo '$?:' $?
30+
else
31+
echo "Please Pass the 3 command line args along with script"
32+
fi

07-string.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
#title :
3+
#description :
4+
#author :myLANDMARK.tech S Legah
5+
6+
string_var="Hi Team, My name is Simon Legah, working in MLT, GTA "
7+
8+
echo "The value of string_var value is: " ${string_var}
9+
10+
echo "The length of the string is: " ${#string_var}
11+
12+
echo "The sub string is:" ${string_var:20:14}
13+
14+
#Index from right end of the string
15+
echo The sub tring value is: ${string_var: (-8)}
16+
17+
echo The sub tring value is: ${string_var: -17}
18+

08-arithmetic_operations.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
#title : Arithmetic operations
3+
4+
expr 3 + 2
5+
expr 3 - 2
6+
expr 3 \* 2
7+
expr 10 / 2
8+
expr 20 % 3
9+
echo addition of 3 and 2 is : `expr 3 + 2`
10+

09-arrya.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
#title :
3+
#description :
4+
#author :myLANDMARK.tech S Legah
5+
#date :08112012
6+
#version :1.0
7+
#Tel :437 215 2483
8+
#usage :
9+
10+
declare -a devopstools
11+
devopstools[0]=GitHub
12+
devopstools[1]=Ant
13+
devopstools[2]=Maven
14+
devopstools[3]=Tomcat
15+
devopstools[4]=Wildfly
16+
devopstools[5]=SonarQube
17+
18+
19+
#Displaying 1st value
20+
echo ${devopstools[0]}
21+
22+
#Displaying 5th value
23+
echo ${devopstools[4]}
24+
25+
#Displaying all values
26+
echo ${devopstools[*]}
27+
28+
#Displaying all values
29+
30+
echo ${devopstools[@]}

09-read0.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
echo "Please enter your name"
4+
read name
5+
echo "Your name is: " $name
6+
echo please enter 1st number1
7+
read number1
8+
echo please enter 2nd number2
9+
read number2
10+
echo The sum is `expr $number1 + $number2`

777.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sudo dnf -y config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
2+
sudo dnf -y repolist -v
3+
sudo dnf -y install docker-ce-3:18.09.1-3.el7
4+
sudo systemctl enable --now docker
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
#author : Simon Legah
3+
#CopyRights : Landmark Technologies
4+
#Contact : +1 437 215 2483
5+
echo "Enter your GitHub Personal Access Token:"
6+
read token
7+
#echo $token >token.txt
8+
#cat token.txt
9+
cat ~/.ssh/id_rsa.pub
10+
#if condition to validate weather ssh keys are already present or not
11+
if [ $? -eq 0 ]
12+
then
13+
echo "SSH Keys are already present..."
14+
else
15+
echo "SSH Keys are are not present..., Create the sshkyes using ssh-keygen command"
16+
ssh-keygen -t rsa
17+
echo "Key successfully generated"
18+
fi
19+
sshkey=`cat ~/.ssh/id_rsa.pub`
20+
if [ $? -eq 0 ]
21+
then
22+
echo "Copying the key to GitHub account"
23+
curl -X POST -H "Content-type: application/json" -d "{\"title\": \"SSHKEY\",\"key\": \"$sshkey\"}" "https://api.github.com/user/keys?access_token=$token"
24+
if [ $? -eq 0 ]
25+
then
26+
echo "Successfully copied the token to GitHub"
27+
exit 0
28+
else
29+
echo "Failed"
30+
exit 1
31+
fi
32+
else
33+
echo "Failure in generating the key"
34+
exit 1
35+
fi

createuser1.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
# Creating a user
3+
echo "Please enter the user name for the account you want to create!"
4+
read userName
5+
echo "The name you entered is: " $userName
6+
/usr/sbin/useradd $userName
7+
/usr/sbin/usermod -G devops $userName
8+
echo ".......User is created..........."
9+
echo ".......Now Set the password for ....... $userName"
10+
passwd $userName

createuser2.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
# Create user and grant sudo access
3+
if [ $# -ne 1 ]
4+
then
5+
echo "Usage: $0 username"
6+
exit
7+
else
8+
USERNAME=$1
9+
fi
10+
11+
# creating user
12+
/usr/sbin/useradd $USERNAME
13+
passwd $USERNAME
14+
15+
echo "User has created successfully.."
16+
echo "Providing sudo access.."
17+
18+
# Giving sudo access
19+
sed -i "/NOPASSWD/a\\$USERNAME ALL=(ALL) NOPASSWD: ALL" /etc/sudoers
20+
21+
echo "Sudo access successfully granted to $USERNAME"

cron.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*/2 * * * * /home/devops/scripts/date.sh > /home/devops/scripts/date.log 2>&1
2+
3+
tee
4+
ll | tee ab.txt
5+
ll > ll.txt
6+
script

devops videos

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hh

f.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
0
2+

ff

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ZZ

fn

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
echo "Function demo starts.."
2+
3+
greetfn()
4+
{
5+
echo "Hello everyone"
6+
echo "good morning"
7+
}
8+
9+
echo "calling the function"
10+
greetfn

0 commit comments

Comments
 (0)