Hello Everyone,
In this tutorial,
Let Us Create a Sailing Through The World of Linux BASH Scripting – Part III
You Can also Configure in Redhat Linux, Ubuntu,
Fedora, CentOS, LinuxMint, Oracle Linux, Cloud Linux.
Move Current Working Directory
Create a Random File or Folder
Script to Converts UPPERCASE to lowercase
Simple Calculator Program
Move Current
Working Directory
#! /bin/bash
LEVEL=$1
for ((i = 1; i <= LEVEL; i++))
do
CDIR=../$CDIR done cd $CDIR
echo "You are in: "$PWD
exec /bin/bash
Create a Random File or Folder
#! /bin/bash
echo "Hello $USER";
echo "$(uptime)" >>
"$(date)".txt
echo "Your File is being saved to $(pwd)“
echo‘ : Prints everything written within the quotes.
‘$‘ : Is a shell variable.
‘>>‘ : The output is redirected to the output of
date command followed by txt extension
Script to
Converts UPPERCASE to lowercase
touch small.txt
#!/bin/bash
echo -n "Enter File Name : "
read fileName
if [ ! -f $fileName ]; then
echo "Filename $fileName does not exists"
exit 1
fi
tr '[A-Z]' '[a-z]' < $fileName >> small.txt
Simple Calculator Program
#! /bin/bash
clear
sum=0
i="y"
echo " Enter one no."
read n1
echo "Enter second no."
read n2
while [ $i = "y" ]
do
echo "1.Addition"
echo "2.Subtraction"
echo "3.Multiplication"
echo "4.Division"
echo "Enter your choice"
read ch
case $ch in
1)sum=`expr $n1 + $n2`
echo
"Sum ="$sum;;
2)sum=`expr $n1 - $n2`
echo
"Sub = "$sum;;
3)sum=`expr
$n1 \* $n2`
echo
"Mul = "$sum;;
4)sum=`expr
$n1 / $n2`
echo
"Div = "$sum;;
*)echo
"Invalid choice";;
esac
echo "Do u want to continue (y/n)) ?"
read i
if [ $i != "y" ]
then
exit
fi
done
NOTE :- For Any Clarification Please Below
Comment,
Like and
Share us and help us to spread.
####--------------------------------------------------------------------------------------####
Website
:- http://www.cloudnetwork.in
Facebook :- http://facebook.com/itCloudNetwork/
Twitter
:- http://twitter.com/itcloudnet
Pinterset
:- http://pinterset.com/itcloudnet
LinkedIn :- http://in.linkedin.com/pub/itcloudnet
Skype Id
:- cloud.network1
E-Mail Id :- itcloudnet@gmail.com
####----------------------------------------------------------------------------------------####
Thanking You
Hope U Like it........