![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| error in if statement | Swapna173 | UNIX for Dummies Questions & Answers | 1 | 03-18-2009 08:00 AM |
| Error in IF statement | ravi214u | Shell Programming and Scripting | 4 | 07-14-2008 10:44 AM |
| error in if statement | capri_drm | Linux | 16 | 05-14-2008 02:00 PM |
| Error with if statement..Please help | jisha | Shell Programming and Scripting | 1 | 01-16-2008 07:13 AM |
| while read loop w/ a nested if statement - doesn't treat each entry individually | littlefrog | Shell Programming and Scripting | 7 | 12-11-2007 09:49 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Nested If Statement Error
I'm new to shell scripting and trying my hand with nested if statements, and it seems to work fine until I try to test for an input of filename, then I get "line 40: syntax error near unexpected token `fi'"
I just can't see what's different between having 2 ifs and when I add the 3rd. Any help would be appreciated. -----------------------code---------------- #/bin/sh set -v on set -x on echo "What content file are you going to run?" read file echo "What expiration date? Enter in 01-APR-09 format." read expired if [ "$file" = "" ]; then echo "Need a filename to process." else for asset in ${list[@]}; do list=( `cat $file`) result1=( `sqlplus -S user/pass@db1 << EOF set pages 0 echo off verify off feedback off select package_name from package where package_id = (select substr(path, -20) from content where file_name = '$asset'); exit EOF`) if [ "$result1" = "" ]; then echo $asset else result2=( `sqlplus -S use/pass@db2 << EOF set pages 0 echo off verify off feedback off select expiration_date from offering where package_name='$result1' and expiration_date > '$expired'; exit EOF`) if [ "$result2" = "" ]; then echo $asset fi fi fi done |
|
|||||
Quote:
|
|
|||||
|
I've just ordered your book Mr. Johnson, look forward to reading it.
Are you saying the: Code:
EOF`) Code:
EOF `) Also if sqlplus does not like white space at the beginning of its commands then the lines after the "<<EOF" and before the terminating "EOF" should not be indented, but not sure about whether sqlplus would object to white space or not! |
|
|||||
|
Quote:
Quote:
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|