Error in while loop | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Error in while loop

Shell Programming and Scripting


Tags
sql output

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-22-2013
netdbaind netdbaind is offline
Registered User
 
Join Date: Aug 2012
Last Activity: 16 September 2014, 2:37 AM EDT
Posts: 56
Thanks: 7
Thanked 0 Times in 0 Posts
Error in while loop

I have a file Table.out having table name like this


Code:
Table_Emp
Table_Exp
Table_Fcr

To show first 10 rows .. I' wrtng a script like this ..

[CODE]#!/bin/ksh

cat /tmp/table.out|while read -r table vbar1
do
<connect to db>
then
select * from $table limit 10; > /tmp/1.out
done

[/CODE

Plz help ..But This is resulting in error like this


Code:
ERROR:  'select * from  limit 1;'
error                   ^ found "LIMIT" (at char 16) expecting an identifier found a keyword

Sponsored Links
    #2  
Old 02-22-2013
RudiC RudiC is offline Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 25 October 2014, 1:16 PM EDT
Location: Aachen, Germany
Posts: 4,427
Thanks: 73
Thanked 1,084 Times in 1,022 Posts
Your code tags are destroyed.

What does the quoting in your <connect ... limit 10; code snippet look like?
Sponsored Links
    #3  
Old 02-22-2013
netdbaind netdbaind is offline
Registered User
 
Join Date: Aug 2012
Last Activity: 16 September 2014, 2:37 AM EDT
Posts: 56
Thanks: 7
Thanked 0 Times in 0 Posts
Rudic


Code:
]#!/bin/ksh

cat /tmp/table.out|while read -r table vbar1 
do 
<connect to db>
then
select * from $table limit 10; > /tmp/1.out
done

    #4  
Old 02-22-2013
RudiC RudiC is offline Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 25 October 2014, 1:16 PM EDT
Location: Aachen, Germany
Posts: 4,427
Thanks: 73
Thanked 1,084 Times in 1,022 Posts
Quote:
Originally Posted by netdbaind View Post
. . .
#!/bin/ksh
cat /tmp/table.out|while read -r table vbar1
do
<connect to db>
then
. . .[/CODE]
It certainly is NOT <connect to db> verbatim! What about the quoting therein?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Getting error in while loop manishdivs Shell Programming and Scripting 1 09-01-2011 01:28 AM
While loop error reid Shell Programming and Scripting 4 08-19-2011 02:30 PM
Error Using an if Loop Within a While Loop jonesdk5 Shell Programming and Scripting 4 06-03-2010 11:32 AM
error in for loop??? f_o_555 UNIX for Dummies Questions & Answers 4 01-13-2010 02:18 AM
Error in Loop? rdhaprakasam Shell Programming and Scripting 5 02-18-2009 06:52 PM



All times are GMT -4. The time now is 06:49 PM.