Shel Serei Ping
Aim: weite Sheu Program to add swo )umbereg
#!/bin/bash
a= 10
b: 90
Sum: $((3a +b))
cho Sum is:$sum"
OUTPU T:
Sum is :30
Aim: rute sheu PrOrtam to fisd even Ort odd
!/bis/bash
echo 'enter the unberr;"
then
echo $n is Even ounbere"
se
echo " is Odd number"
OUTPUT:
eoter the um ber
95
95 iS odd oumber
Aim: wrute a Shel Surlt thoat Cal Culates he Sum of insegery
frrom 1 to N wging a Joco.
#!/bin/bagh
echo Entert a nunberr:
For (i-1; i<= $0,; itt)); do
Sum= (Csum ti))
done
echo Sum of iOtegerg from 1 t0 $o is:$Sum'
OUTPUT:
Entere a numbere
Sum of iotegery frrom 1 to 5 is: 15
Aim: r e a Shel SriPt Jo Check wheher the ounbert ie
Paliodrome
t/bin/ bagh
echo Enter o number"
K: (epre toz0)
done
if Snum -eq on]
echo '$on is Paindrome
ese
echo Son iS not Palin drome"
OUTPUT:.
Ote a nwmbe
121
121 iS Palindrome
Aim: ite a Shel Seript Jo checK wheher he sum bere i Prume
+!/bin/ bagh
f =0
do
hen
f=1
done
then
Pcho Nos prine"
Use
echo Prine"
Basics of Linux Command:
1. FiUe relted coman:
’ Cat
.Cat Commd is sed to Create a H)e
. This Cemmand is uso used fore d's PJay the conterts of a f)e.
Syntai Cat >(Fnames
ExamPe: Cat ) Aett
Helo cs Sudends
" TiS Commanis ued forr SSHing fye and diretories.
Ex amfle: S
Docunends DownJoadg Music P:Cturres
’aeart
. ThS Commandis used torc aeare he termisal Sceen
Syaa: Ueart
Ex amRe: uear
" This Command is ued fon movi n and reenaming les and
d'retorieg
Syota
Exampe: file1. t /Decunens/
Q. Dirretory related Commasds.
"This Cosmmand is used Create an empry retoy i a disK.
on Kdirt <duname)
Exame; smk di Prrogrram
" This Command S weed to remove a directory frOsn he sK.
Synta mir <d.same)
Eam P)e m dir Program
.This ConandiS used o move from o0e dneo to anoher
directony
ExamPlei cd Program
Pwd stand fort Print worKing direuorg"
" ThiS Comnand is wed o Prit he Curcrert working dircectory.
This omenard S ed (ore Searrcheg les and folder.
Syrar: Jocote e,x)
Examp)e: )o Cate
/Documerds/e,3t
3. General Purfose Cosmmands:
date
"This Commad is ued o display he curnert date uw'th doy,
month, dte, ime (9y has ClocK) yCart
Syouax: date
Examle: dale
Wed Jul 8 o8:17:94 EDT 9o24
’ Cal
This Command wed to di's play the Curenent moth, al moths of
PattiCalar yeare
Syntar : Cal
Elampe: cal
December 9094
Su MO Tu We Th Sa
4 9 5
12 13
90
99 25 21 26
94 31
. The y(actyee) Conmand is ugeA to Prind the Gaunnerd eriral
Syrdot;
biswaji