I have to match the table column via shell script ,where col name is value,like if table's column value is N then proceed to next main script.if not then exit with Some message.'not validated'
Table o/p comes like this way.where value is column name.
I tried this ,but looks like I'm missing something.For all run I 'm getting NO.Please help
Aim: check the value in file value.out (above stated).if value is N then go and start main script (here i kept echo yes).if not N i.e Y then start another script.(here i kept echo no ) for test.
#!/bin/bash
x=`sed -n '3p' value.out`
S1='N'
S2='Y'
if [ "$x" == "$S1" ];
then
echo yes
else echo No
fi
Yes. The "problem" is that the (correct) result of the sed command is actually N , notice the preceding whitespace. So right now you are comparing " N" and "N" and thus the result is No.
Solution: Remove that leading whitespace and try again. There are many ways to perform that, I prefer this: