The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Global variable declaration in shell scripting susilgandhi Shell Programming and Scripting 1 02-06-2008 12:59 AM
Array Declaration and For Loop 33junaid Shell Programming and Scripting 4 09-15-2007 05:16 PM
awk field declaration?? tonet Shell Programming and Scripting 1 09-12-2007 09:23 AM
double variable declaration kotasateesh Shell Programming and Scripting 3 08-31-2007 06:29 AM
Variable declaration laila63 High Level Programming 2 07-07-2004 04:37 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-08-2006
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 190
Help with variable declaration

I declared a variable x that gets the count(*) from a table. The table name is also defined as a variable.

What's wrong with this statment :

X=” select count(*) from ${table_name}“

then

y = `${X}${table_name}’

echo ${y}

It throws an error saying count not found.

Please suggest
  #2 (permalink)  
Old 12-08-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Are you using backticks (`) in the assignment to y? Or are you using single quotes (')?

If you use (`), then the shell will try to execute the command inside those backticks and assign the output to the variable y. While doing this, the 'select' is admitted by the shell as it is a shell builtin, but 'count' isn't so it tries to look for an executable file named count in your path, fails and throws the error.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0