evaluating params


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers evaluating params
# 1  
Old 11-20-2005
evaluating params

Hi all,

I ve a script like....

TBL=employee
sql=`cat abhi.sql` \\ abhi.sql contains ------- select a from $TBL
echo $TBL
echo $sql
SQL=`echo $sql`
echo $SQL



now i want SQL as select a from employee
and as select a from $TBL

How can I achieve this?
Help appriciated
# 2  
Old 11-20-2005
Consider using PHP or PERL, both have extensive support for database interaction.
# 3  
Old 11-21-2005
Small correction...

now i want SQL as select a from employee
and as select a from $TBL


should ve been
now i want SQL as select a from employee
and NOT as select a from $TBL
# 4  
Old 11-22-2005
Ditto on the Perl suggestion. But to answer your quickie shell script question,

SQL=`eval echo $sql`

More correctly, you probably don't need to create a new variable:

sql=`eval echo $sql`

-Mike
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing vars or params to function

How to pass the getopts processed variable "${@}" to a function? It contains a list of package names needed in various functions. Seems the issue I have is due to the order of the script, with the processed "${@}" falling after the unprossed "${@}". I've been manually parsing options in the... (3 Replies)
Discussion started by: Cody Learner
3 Replies

2. Shell Programming and Scripting

grep unknown number of params

Hey i got trivial question but i cant figure it out. I want to grep a file for multiple unknown parameters. The user will enter these parameters at the command line. For example... ./program red apple filename This would grep for the phrase red apple. But i cant just do $1 $2 because the... (8 Replies)
Discussion started by: GmGeubt
8 Replies

3. Shell Programming and Scripting

Check params for number

I have 2 and three params, both I should make sure thay numbers at one single line insted of checking for each one . Example I wroote the following way.. checking for 2 and three seperately but I shud be able to do it at on statement echo $2 | egrep '^+$' >/dev/null 2>&1 if ; then echo... (2 Replies)
Discussion started by: raopatwari
2 Replies

4. Shell Programming and Scripting

Pass params with Udev

Hello! I'm sorry if this is the false Forum, didn't really knew where to put it... My question: I have serveral USB-Sticks and wrote several Udev-Rules for theme, each Sticks needs to do something else, but all are using the same script (they have common tasks to do) and only some parts are... (2 Replies)
Discussion started by: al0x
2 Replies

5. Shell Programming and Scripting

Does awk ever resolve params ?..

Hi, Does awk ever resolve params in the search pattern?.. The following awk doesnt know how to resolve ${tables}$ inside a loop. k=`awk '/${tables}$/ ${graph}` The search pattern has ${tables}$ and I am narrowing down my search with a $ at the end of string. So...this leaves me with a... (13 Replies)
Discussion started by: anduzzi
13 Replies

6. Shell Programming and Scripting

calling a program (w/ params) from within shell

Hi all, I need to call some script (s1) from within my shell script (s2). s1 accepts parameters and I want to feed it with values of params from my script. I tried many things but none work (I am so much of a beginner), please help one of my attempts : . . . param1="hehe" param2="haha" ... (12 Replies)
Discussion started by: Lorna
12 Replies

7. Solaris

Solaris 10 kernel Params, Set/Get?

I am experienced with Solaris 8 where this type of thing was handled from /etc/system but now I have a Solaris 10 server and I am having trouble determining how to interact with the kernel parameters. I need to know how to check the values of the following, of the DB people I work with. MAX... (8 Replies)
Discussion started by: NewSolarisAdmin
8 Replies

8. Shell Programming and Scripting

script takes params

i want to write a shell script that can be run as ./deployPortal.sh -version 5.1.2 -portlet -exportall how can i do that? version param is required. bu the others are optional. in first step i only want to read 5.1.2, is portlet selected ? and is exportall selected ?? can you... (2 Replies)
Discussion started by: keromotti
2 Replies

9. UNIX for Advanced & Expert Users

Change params for time zone

Hi! How ican change parameters for daylight, i mean, i want change the daylight on december first week. I've tried with /usr/lib/tztab but result unsuccessful. (7 Replies)
Discussion started by: agustincm
7 Replies

10. HP-UX

unable to change kernel params?

i have hp-ux 11i on a rp2470 machine. i'd like to change some kernel params with SAM. i change the params, process new kernel and reboot the system. after reboot i found that params does not change. i have done the same things many times but i still have the pb. plz what to do? (1 Reply)
Discussion started by: nabil_boussetta
1 Replies
Login or Register to Ask a Question