#!
/bin/sh
a=$1
b=$2
result=`expr $a + $b`
echo "Result is $result"
#!/bin/sh
a=$1
b=$2
result=`expr $a + $b`
echo "addtion of two numbers : $result"
result1=`expr $a - $b`
echo "subtraction of two numbers : $result1"
result2=`expr $a \* $b`
echo "Multi of two numbers : $result2"
result3=`expr $a / $b`
echo "Division of two numbers : $result3"
welcome to uniq
and
welcome to chennai and welcome to tnagar
# greater than two number
if [ $1 -gt $2 ]
then
echo "A is greater"
else
echo "B is greater"
fi
#!/bin/sh
case "$1" in
Manisha)
echo "Hi Manisha. Nice to see you"
;;
Deepan)
echo "Oh! Its you, is it, Deepan?"
;;
Sridhar)
echo "Clear off!"
;;
*)
echo "Who are you?"
;;
esac
#!/bin/sh
FRUIT="$1"
case "$FRUIT" in
"apple") echo "Apple pie is quite tasty."
;;
"banana") echo "I like banana nut bread."
;;
"kiwi") echo "New Zealand is famous for kiwi."
;;
esac
#!/bin/sh
# Script to check that the user enters one argument, "fred"
if [ "$1" ]
then
echo "Found an argument to this script"
if [ $1 = "Afra" ]
then
echo "The argument was Afra!"
else
echo "The argument was not Afra!"
fi
else
echo "This script needs one argument"
fi
#!/bin/sh
# checks whether a named file exists in a special directory (stored in
# the dir variable). If it does, prints out the top of the file using
# the head command.
# N.B. establish your own dir directory if you copy this!
dir=/home/cs0ahu/safe
if [ -f $dir/$1 ]
then
head $dir/$1
fi
date
mv /home/nadz/aug2022/[Link] /tmp
exit_status=`echo $?`
if [ $exit_status -eq 0 ]
then
echo "sucessfully move the file"
else
echo "failure during move the file"
fi
#!/bin/sh
# Check for the word "and" in a file
result=`grep and $1`
if [ "$result" ]
then
echo "The file $1 includes the word and"
fi
bye
#!/bin/sh
# show script
# check dir or file.
if [ -d $1 ]
then
ls $1
else
cat $1
fi
#!/bin/sh
# join command - joins two files together to create a third
# Three parameters must be passed: two to join, the third to create
# If $3 doesn't exist, then the user can't have given all three
if [ "$3" ]
then
# this cat command will write out $1 and $2; the > operator redirects
# the output into the file $3 (otherwise it would appear on the screen)
cat $1 $2 > $3
else
echo "Need three parameters: two input and one output. Sorry."
fi
#!/bin/sh
# purpose: print out current directory name and contents
pwd
ls
welcome
#!/bin/sh
today=`date`
echo "Today is $today"
#!/bin/sh
# name is a variable
name="Nafia"
echo "The name is $name"
Hai
welcome
name=$1
echo "The name is $name"
#!/bin/sh
echo "hello world"