bash code
1,3,5…99 | for (( c=1; c<=99; c+=2 )) do echo “Welcome $c times” done |
for i in {1..99..2} do echo $i done |
assign value
read input |
read wowo echo “Welcome $wowo” |
|
calculation output in shell | read X read Y echo “$(($X+$Y))” echo “$(($X-$Y))” echo “$(($X*$Y))” echo “$(($X/$Y))” |
|
if (( a > b )); then … fi |
echo “enter two numbers”;
read a b; echo “a=$a”; |
|
#!/bin/bash
$a = 2462620 if [ “$a” -eq “$b” ];then |
-eq # equal -ne # not equal -lt # less than -le # less than or equal -gt # greater than -ge # greater than or equal |
#!/bin/sh a=10 b=20 if [ $a == $b ] then echo “a is equal to b” elif [ $a -gt $b ] then echo “a is greater than b” elif [ $a -lt $b ] then echo “a is less than b” else echo “None of the condition met” fi |