Hi,
I have a shell script which executes some sql. When the shell script executes the sql's logging is shown on the console. I need to grep some data from this output shown on console. So I do the following
hive -f load.adj.hql 2>&1 | tee c.txt
echo $?
A=`grep num_rows c.txt`
$? will again always be 0 whether load.adj.hql passes or fails.
How do I make $? reflect status of hive -f load.adj.hql BUT also capture output on console?
---------- Post updated at 12:30 PM ---------- Previous update was at 12:22 PM ----------
I got the answer
echo ${PIPESTATUS[0]}