how to assign value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to assign value
# 1  
Old 05-24-2011
how to assign value

Code:
#! /bin/bash
 if [ $# -lt 1 ]; then
  echo "Set number "
else
k=$1
  sqlplus ${scheme}/${apsswd}@${server}  @query.sql  $k 
fi

file query.sql looks like this

Code:
select *  from tab1    where number =${k};

===================================
it doesnt work
my question is how to assign k value in last line
can anybody help my with it ?

Last edited by pludi; 05-24-2011 at 10:10 AM..
# 2  
Old 05-24-2011
try using this code in query.sql instead :

Code:
select *  from tab1    where number ='&1';

This User Gave Thanks to pratham For This Post:
# 3  
Old 05-24-2011
thanks its working Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check assign

I have a person script which has a following statement. BUILD_FOLDER=$2 i=$((${#BUILD_FOLDER}-1)) if then BUILD_FOLDER=$BUILD_FOLDER/ #echo $BUILD_FOLDER else echo " " #echo $BUILD_FOLDER fi What and how this statement works ? i=$((${#BUILD_FOLDER}-1)) (5 Replies)
Discussion started by: ilugopal
5 Replies

2. Shell Programming and Scripting

Unable to assign a value

I have written a shell script to calculate dbsize :- db2 "call get_dbsize_info(?,?,?,-1)" | sed -n '8p' | awk -F : '{print $2}' dbsize=`db2 "call get_dbsize_info(?,?,?,-1)" | sed -n '8p' | awk -F : '{print $2}'` echo $dbsize when I execute it the syntax works but it's not... (11 Replies)
Discussion started by: lazydev
11 Replies

3. UNIX for Dummies Questions & Answers

Assign dir name

Hi guys i need to assign to a $var the name of a directory i've created before like this: mkdir cd /esb/cargomax/fuse/SMX_SV_$(date +%F) i guess this is very simple, but..... Thanks!! (3 Replies)
Discussion started by: Newer
3 Replies

4. Linux

HOW TO assign IP in REDHAT 6?

Hi Guys, It may sound silly questions but I am really confused and forgot the sequence to set IP in REDHAT 6. 1st type system-config-network then I give IP as 192.168.1.78 Subnet as 255.255.255.0 Then do /etc/init.d/network restart Then when I check with ifconfig eth0... (1 Reply)
Discussion started by: manalisharmabe
1 Replies

5. Shell Programming and Scripting

Assign the value

DATA --------------- 0 Please tell me, if the file contains 0 after --. then assign the value to variable $var=false, DATA --------------- 1 then $var=true, (2 Replies)
Discussion started by: sandy1028
2 Replies

6. Shell Programming and Scripting

Not able to assign a value to variable

Hi Experts, I am facing some problem while developing the script.My input config.csv file contains the three columns namely pathname,filename,filetype.Based on the file type i have to use ftp command that is if filetype=csv then do ftp. The input file is cat config.csv... (13 Replies)
Discussion started by: Amey Joshi
13 Replies

7. Shell Programming and Scripting

Using bc to assign value

Friends here is code which is used to add floating point using bc, but I m not getting any output instead some errors. 1 #!/bin/bash 4 if 5 then 6 echo "Our input is from a Device" 7 while read myline 8 do 9 10 total= `echo $total + $myline... (2 Replies)
Discussion started by: navjinder
2 Replies

8. Shell Programming and Scripting

Assign a sting to a name?

i want to assign a anme for a string, i got the things below, but it doesn't work. MParc1=`` if then $MPrac1=`Prac1` # assign $MPrac1 to Prac1 else $MPrac1=`` #assigne $MPrac1 to nothing fi echo "${MPrac1} >>file Output: (if num is 0) Prac1 can you please... (6 Replies)
Discussion started by: mingming88
6 Replies

9. Shell Programming and Scripting

How to assign the specific value

Hi Everyone, How to assign the specific value which return from database? here is the return value from database --> (return status = 0) 0 <----- this I only need to get the "0" .. assign to another declare variable. hope someone will help me.. Please thank you.. (4 Replies)
Discussion started by: ryanW
4 Replies

10. Shell Programming and Scripting

assign a value to variable

I have to assign a result of a query to a vairable like this how can i do this Query = select count(*) from table x=`db2 ${Query}| sed -n '4p'` but this doesn't work, is there any other way to assign the result without redirecting the result to temp file. . Thanks Mark. (3 Replies)
Discussion started by: markjason
3 Replies
Login or Register to Ask a Question