Important If Condition, For Loop While Loop
if Condition : Syntax
If { condition }
then {statement}
elif {condition }
{statement }
fi
Example
If [ $a ==10 ]
then
echo “value is Ten”
else
echo “Value is not Ten”
fi
For Loop- Method -1
For ( ( c=1;c<=5;c++))
do
echo “ Welcome $c times “
done
Method 2
for c in 1 2 3 4 5
do
echo "welcome $c Times"
done
Method 3
for c in {1..5}
do
echo "welcome $c Times"
done
Number comparison in shell script
--eq
--ne
--lt
--gt
-ge
Read variable in shell script
read { variable name }
While Loop Statement
c=3;
while [ $c -le 15 ]
do
echo "Welcome $c times"
((c++))
done
Switch case Example
Check=1
Case $check in
1) echo “redhat;;
2) echo “ubunut” ;;
*) echo “none”
esac
Trigger the Back Ground Process to foreground
Process Id Vary from 0 to 65535
Shell Script How To Do The Addition With Variable
S=$((10+$i)) just like for loop for ((;;))
if Condition : Syntax
If { condition }
then {statement}
elif {condition }
{statement }
fi
Example
If [ $a ==10 ]
then
echo “value is Ten”
else
echo “Value is not Ten”
fi
For Loop- Method -1
For ( ( c=1;c<=5;c++))
do
echo “ Welcome $c times “
done
Method 2
for c in 1 2 3 4 5
do
echo "welcome $c Times"
done
Method 3
for c in {1..5}
do
echo "welcome $c Times"
done
Number comparison in shell script
--eq
--ne
--lt
--gt
-ge
Read variable in shell script
read { variable name }
While Loop Statement
c=3;
while [ $c -le 15 ]
do
echo "Welcome $c times"
((c++))
done
Switch case Example
Check=1
Case $check in
1) echo “redhat;;
2) echo “ubunut” ;;
*) echo “none”
esac
Trigger the Back Ground Process to foreground
Process Id Vary from 0 to 65535
Shell Script How To Do The Addition With Variable
S=$((10+$i)) just like for loop for ((;;))
0 comments:
Post a Comment