Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- num1=1
- num2=10
- if [ $num1 -gt $num2 ]; then
- echo "number one is greather "
- else
- echo "number two is greater"
- fi
- @for comapre number
- ...................................
- #!/bin/bash
- num1=1
- num2=10
- if [ $num1 -eq $num2 ]; then
- echo "number is equel "
- else
- echo "not equel"
- fi
- @for check odd or even number
- ......................
- #!/bin/bash
- echo -n "please enter a number"
- read n
- check=$(($n % 2))
- if [ $check -eq 0 ];then
- echo "$n is an even number"
- else
- echo "$n is an odd number"
- fi;
- -------------------------------
- @for string comparisom
- #!/bin/bash
- num1="jahid"
- num2="arif"
- if [ $num1 = $num2 ]; then
- echo "name is equal "
- else
- echo "not equal"
- fi
- -----------------------
- @FOR counting
- #!/bin/bash
- COUNT=6
- while [ $COUNT -gt 0 ]; do
- echo value of count is: $COUNT
- let COUNT=COUNT-1
- done
- ----------------
- @ for reverse
- #!/bin/bash
- COUNT=1
- while [ $COUNT -lt 7 ]; do
- echo value of count is: $COUNT
- let COUNT=COUNT+1
- done
- -----------------------
- #!/bin/bash
- COUNT=0
- until [ $COUNT -gt 5 ]; do
- echo value of count is: $COUNT
- let COUNT=COUNT+1
- done
- @ addition
- echo '#### let ###'
- let addition=3+5
- echo "3+5 =" $addition
- @subtraction
- echo '#### let ###'
- let subtraction=5-3
- echo $subtraction
- @power of
- echo '#### let ###'
- let poweroftwo=2**2
- echo "2^ 2=" $poweroftwo
- @mathmatatics
- echo 2^8 =$[ 2** 8 ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement