The below code snippet shows how can we use comparison operator in shell script for number.
-bash-3.2$ cat comparion_op_ex
#!/bin/bash
x=10
y=10
echo -e " value x = $x and y = $y"
if [ $x -eq $y ] ; then
echo -e " x and y are same value\n "
fi
x=10
y=20
echo -e " value x = $x and y = $y"
if [ $x -ne $y ] ; then
echo -e " x and y are not equal \n"
fi
x=20
y=10
echo -e " value x = $x and y = $y"
if [ $x -gt $y ] ; then
echo -e " x is greater than y \n"
fi
x=10
y=20
echo -e " value x = $x and y = $y"
if [ $x -lt $y ] ; then
echo -e " x is less than y\n"
fi
OUTPUT :
-bash-3.2$ sh comparion_op_ex
value x = 10 and y = 10
x and y are same value
value x = 10 and y = 20
x and y are not equal
value x = 20 and y = 10
x is greater than y
value x = 10 and y = 20
x is less than y
-bash-3.2$
gt --> greater than
lt --> less than
eq --> equal
ne --> not equal
A Language is not worth knowing unless it teaches you to think differently.
Subscribe to:
Post Comments (Atom)
Price List Query for Item
SELECT qph.list_header_id, qph.name, qph.description, qphh.start_date_active, qphh.currency_code, q...
-
1. To download Ldt file for a Concurent Program FNDLOAD [username]/[password] O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct file_nam...
-
Here the article will describe about how to register WebADI to Responsibility menu Go to System Administrator --> Security --> Respo...
-
using the below query can check the invoice status. SELECT DECODE(AP_INVOICES_UTILITY_PKG.GET_APPROVAL_STATUS(AIA.INVOICE_...
No comments:
Post a Comment