Nested-double loop error
I have a nested loop in a shell script I'm writing. Both loops are reading from files. The outside loop works fine but the inner loop keeps giving me an error:
./loops[13]: insideline: not found. It doesn't matter what name I give the variable, it always fails with this error. My script is below. Any help would be appreciated. #! /bin/ksh -xv # # Testing loops rm /userimport/userimport rm /userimport/existingaccounts # Edit the userimport file so that dupes are removed from the new file. while line=$(line) # /userimport/userimport do templine=$line echo $templine > /tmp/greptemp while insideline=$(insideline) # /userimport/acctcompare do grep $insideline /tmp/greptemp if [[ $? -eq 0 ]] then tempcount=1 fi done < /userimport/acctcompare if [[ $tempcount -eq 1 ]] then echo $line >> /userimport/userimport.sorted else echo $line >> /userimport/existingaccounts fi tempcount=0 done < /userimport/filedrive.alabama |
$(...) performs command substition, i.e. it runs whatever is in the parentheses as a command. Thus:
Quote:
Quote:
Change the latter to Code:
while insideline=$(line) # /userimport/acctcompare Code:
sort /userimport/userimport | uniq |
Quote:
|
your insideline variable is not pluging in
|
All times are GMT -5. The time now is 01:14 AM. |