Linux serverNETWORK ADMINISTRATIONS

How to Use Variables, Arguments, Single Quotes, Double Quotes, Back Tick in Bash Scripting

How to Use Variables, Arguments, Single Quotes, Double Quotes, Back Tick in Bash Scripting
#DevOps #AWS #Variables #Arguments #SingleQuotes #DoubleQuotes #BackTick #BashScripting

cd /e/classes/815ambatch/centos7
vagrant up
vagrant ssh
sudo -i
cd /opt/
ls
cd bashscripts/
ls
cp websetup.sh vars_websetup.sh
vim vars_websetup.sh
PACKAGE=”httpd wget unzip”
$PAICKAGE
SERVICE=”httpd”
$SERVICE
TEMPFILES=’/tmp/.webfiles’
$TEMPFILES
WEBURL=’URL’
$WEBURL
ARTNAME=’filename’
$ARTNAME
./vars_websetup.sh
ifconfig
vim myargs.sh
#!/bin/bash

echo “value of 0 is ”
echo $0

echo “value of 1 is ”
echo $1

echo “value of 2 is ”
echo $2

echo “value of 3 is ”
echo $3

cat myargs.sh
chmod +x myargs.sh
./myargs.sh
cp vars_websetup.sh args_websetup.sh
vim args_websetup.sh
Replace $WEBURL with $1
$ARTNAME $2
vim dismantlehttpd.sh#
#!/bin/bash

systemctl stop httpd
yum remove httpd -y
rm -rf /var/www/html/*
:wq
chmod +x dismantlehttpd.sh
./dismatlehttpd.sh
ls /var/www/html/
ls
cat dismatntlehttpd.sh
./args_websetup.sh weburl artname
ifconfig
ls /var/www/html/
./dismantlehttpd.sh
echo “Something Learning About BashScript”
echo Something Learning About BashScript’
Address=”Yellareddyguda, Ameerpet”
echo “I am staying in $Address”
echo “I costed me $50 for the vaccine”
echo “$ADDRESS vaccine costed me $50 for the vaccine”
free -m
free -m | grep Mem
free -m | grep Mem | awk ‘{print $4}’
FREERAM=`free -m | grep Mem | awk ‘{print $4}’`
echo $FREERAM
uptime
UP=`uptime`
echo $UP
UP=`uptime | awk ‘{print $9}’`
echo $UP
FREERAM=$(free -m | grep Mem | awk ‘{print $4}’)
echo $FREERAM
vim expvars.sh
#!/bin/bash

echo “I have $car car.”
:wq
car=”Benz”
echo $car
chmod +x expvars.sh
./expvars.sh
export car
./expvars.sh
exit
ls -a
vim .bashrc
export CAR=”Benz”
export BIKE=”Glamour”
:wq
source .bashrc
echo $BIKE
echo $CAR
exit
sudo -i
echo $BIKE
echo $CAR
vim /etc/profile
export vaccine=”Covaccine”
source /etc/profile
echo $vaccine
echo $BIKE ani vagrant lo isthe raale
sudo -i ichaka
echo $BIKE an isthe vachindi
root lo
df -h
df -h | grep root
df -h | grep root | awk ‘{print $4}’
ROOTPart=`df -h | grep root | awk ‘{print $4}’`
echo $ROOTPart

Related Videos
How to Set Cloud Watch Alarms on CPUUtilization of EC2 Instances in AWS

Replace Website from EC2 Instances in an Auto Scaling Group

How to Create And Execute BashScript File with Deploy One Website

How to Launch Instance in EC2 AWS Service And How to Attach Template to That Instance

source

centos 7

Leave a Reply

Your email address will not be published. Required fields are marked *