I am new to shell scripting required some help in passing the parameter value to the shell script.
I am writing a shell script, in the script I have created two functions as below.
first function
get_trend_ids () {
Here I am connecting to the database and getting all the trend id's in a trend_ids.txt file, this file will be stored in /root/edw/trend/srcfiles
}
second function
Load_trend_data () {
Here I am connecting to the teradata database and calling a teradata store procedure as below
EXEC SP_TREND_DATA_LOAD( trend_ids) }
Now the file which I have generated using the first function has to be used in the place of trend_ids which is highlighted with red color below.the procedure has to execute for all the values which are present in the trend_id.txt
EXEC SP_TREND_DATA_LOAD( trend_ids) }
I tried using while read loop here , but I don't don't know how to use that here.
Can anyone tell me the above part, how can I code in the shell script.
Try changing
to
To keep the forums high quality for all users, please take the time to format your posts correctly.
First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)
Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.
Hello Everyone,
I have developed a shell script which takes schema id and password as parameter to login into database using sqlplus,runs a query and mails the result.
My requirement is that, I dont want to pass userid and password as parameters.Instead,I want to pass say Environment... (4 Replies)
I have a script that uses more than one parameter. It looks like this:
for i in `cat /tmp/listofpolicies`;
do
for x in $(cat /tmp/lst |sed 's/^/\/usr\/openv\/netbackup\/db\/class\//g');
do /usr/openv/netbackup/bin/admincmd/bpplinclude $i -delete -f $x;done;done
The problem is that the... (3 Replies)
we are using following script to execute stored procedue. The problem is run_pmcmd.ksh script is using $*
parameter which is not taking in account 'Men Shirt' parameter which includes spaces.
1. Step 1
run_pmcmd.ksh CONVERT_TEST
script for run_pmcmd.ksh
/u01/$(whoami)/run_pmcmd.ksh... (11 Replies)
I'm working on AIX 6, ksh shell. The parameters are some strings quotated by double quotation marks which from a file. They are quotated because there may be spaces in them.
Example:
"015607" "10" " " "A"I want to pass these parameters to a shell function by writing the following command:
... (4 Replies)
how can i make a script to run only when parameters are given,
if parameters are not given it should through an error , saying "please enter a parameter"
for ex: i want a find command to run only when the parameters are given (4 Replies)
I've found a few posts regarding passing parameters to a function or subroutine, but for some reason when I try to run a command based on part with these parameters it's not working. If I have the function echo the parameters they show correctly so I believe they are being passed right but the... (2 Replies)
Hi All,
I have written a shell script and the script is working fine, I am passing my MIT_ID(NUMBER VALUE) to the shell script from the command prompt and my script is executing as expected.
Now I have to pass all the MIT_ID's from a .txt file to the shell script,as I am automating this I... (6 Replies)
Hi ,
I have three funcions f1, f2 and f3 .
f1 calls f2 and f2 calls f3 .
I have a global variable "period" which i want to pass to f3 .
Can i pass the variable directly in the definition of f3 ?
Pls help .
sars (4 Replies)
hi,
i am passing around 14 parameters for a script
a=$1
b=$2
c=$3
d=$4
e=$5
f=$6
g=$7
h=$8
i=\"${9}\"
shift
j=\"${1}\"
still for j it is displaying the 1st parameter value..how to make it take the 10th parameter (2 Replies)
I have 2 scripts: script1 and script2
Script1 passes 4 parameters to script2 as follows
#script1
code
...
...
script2 $var1 $var2 $var3 $var4
Script2 uses the export command to know to expect these values
#script2
export $1 $2 $3 $4
code
...
...
The problem that I am having is... (1 Reply)