This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function print(){ | |
local name=$1 | |
echo "The name is $name" | |
} | |
name="Tom" | |
echo "The name is $name : Before" | |
print Max | |
echo "The name is $name : After " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function print(){ | |
echo $1 $2 $3 | |
} | |
quit () { | |
exit | |
} | |
print Hello World Again |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for (( i=0; i<=10; i++ )) | |
do | |
echo $i | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
n=1 | |
while [ $n -le 10 ] | |
do | |
echo "$n" | |
(( n++ )) | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
vehicle=$1 | |
case $vehicle in | |
"car" ) | |
echo "Rent of $vehicle is 5 lakhs" ;; | |
"van" ) | |
echo "Rent of $vehicle is 4 lakhs" ;; | |
* ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
num1=20 | |
num2=5 | |
echo $(expr $num1 + $num2 ) | |
echo $(expr $num1 - $num2 ) | |
echo $(expr $num1 \* $num2 ) | |
echo $(expr $num1 / $num2 ) | |
echo $(expr $num1 % $num2 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
num1=20 | |
num2=5 | |
echo $(( num1 + num2 )) | |
echo $(( num1 - num2 )) | |
echo $(( num1 * num2 )) | |
echo $(( num1 / num2 )) | |
echo $(( num1 % num2 )) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
read count | |
if [ $count -gt 18 -o $count -lt 35 ] | |
then | |
echo "Valid Age" | |
else | |
echo "Age not Valid" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
read count | |
if [ $count -gt 18 ] || [ $count -lt 30 ] | |
then | |
echo "Valid Age" | |
else | |
echo "Age not Valid" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
read count | |
if [ $count -gt 18 -a $count -lt 35 ] | |
then | |
echo "Valid Age" | |
else | |
echo "Age not Valid" | |
fi |