![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EOF checking the below | ramkrix | High Level Programming | 10 | 03-11-2008 01:43 AM |
| checking uid | filthymonk | Shell Programming and Scripting | 7 | 07-19-2007 10:40 PM |
| Checking cp progress | MarGur | UNIX for Dummies Questions & Answers | 0 | 05-15-2007 04:13 PM |
| Checking for PXE | maestro@altiris | SUN Solaris | 5 | 05-25-2004 12:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||||
|
if then for non-zero
You can do it simpler, but I am assuming that you might have several things to do when a non-zero is found.
This is looking for the last one line of the file; knowing that the value will be on that line. x=$(tail -1 sqlplus.out) echo $x if [ $x -ne 0 ] then echo "You have found a non-zero value" fi |
|
|||||
|
Quote:
Code:
if [ `tail -1 sqlplus.out` -ne 0 ] ; then echo "You have found a non-zero value" ; fi |
|
|||||
|
without the back ticks it didn't work, so thanks go to the Smiling Dragon for helping out and thanks joeyg for the attempt. However, it still doesn't work, I get the following as a result:
Code:
" near 0wn operator in arithmetic expression "0 |
|
||||
|
just a side note what DB are using to get the data out of?
I know if you use certain operaters in DB2 you can cut out all the unneeded stuff like column headers I.E. Code:
db2 -x "select * from your.table" Just a thought. Jim |
|
|||||
|
Quote:
Code:
if `tail -1 sqlplus.out | egrep '[1-9]'` ; then ... |
|
|||||
|
Thanks!
While I am sure your solution works perfectly, I was able to work around the problem by changing my SQL that produces the difference between last id and max id and output 'true' if there is a difference. Now I just need to grep on true from the sqlplus.out file and that satisfies the condition. As always unix.com delivers, in my case not a final solution, but helpful hints to get me there. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|