The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 01-08-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Quote:
Originally Posted by philplasma View Post
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
There is no quotation mark present in the sqlplus.out file, though I decided to vi the file and found that there is a ^M character at the end of each line. I should let you know that this is a unix emulator on a windows server. Another thing to mention is that the result in the sqlplus.out file does not start at the first character, sqlplus right justifies the value with the field header - for whatever reason the unix.com forum interface put it to the left. Thanks again for the assistance!
Ah, in that case, we can make the search for 0 on the last line a little more robust, the following will trigger if you get a non-zero exit code but will ignore any non-digit characters on the line. You could add a second grep for a 0 afterwards to confirm it's given an exit code at all but I've left that off in the example below:
Code:
if `tail -1 sqlplus.out | egrep '[1-9]'` ; then ...