Variables of executed script available in executing script
Hi,
I have a script get_DB_var.ksh which do a data base call and get some variables as below:
Now I want to access all these variables i.e. col1,col2,col3... in the script that executes get_DB_var.ksh as below:
is this possible? or do I have to write values of col1,col2,col3... in a file and then read it in set_DB_var.ksh?
What I want to know is that do we have some command to see the variables of the executed script?? the similar way we have "export" command to have variables available in the called script!
Not sure if I fully understood you, but if you can make sure in your SQL-Query, that there is no header and footer information in the output, you can execute it inside a for loop for example and work through the elements each like:
If you have spaces in the output per col, you might want to use a while read construct instead.
Last edited by zaxxon; 05-11-2010 at 04:17 AM..
Reason: typo which was no typo
By
I mean that script get_DB_var.ksh script takes an argument
so the sql query
will give all the information from the table_name about this file; which I have to access it in another scripts. And I am not allowed (by the design team) to source the script get_DB_var.ksh ! just allowed to execute it within the scripts which need those DB variables.
Hi zaxxon,
I some how want to have access to those variables in the script executing the get_DB_var.ksh script.
-dips
If you want to use those variables in a subsequent script, you have to either export them and start the subsequent script from your main script or, you have to write those variables to a file, so that the 2nd script can read them.
Hi,
now I am writing the sqlplus output to a file; as below:
The format of result_file will be as below:
but is there a way to get the format as below:
i.e. a new line char I tried something like this:
also <CR> instead of \n but to no avail.
Hi All,
I have written a programme where i need to work in one session but when that session get executed it doesnt execute other programme till I write exit. Below is the script
#!/bin/bash
echo 'Going to start'
exectrusteduser.com sh.com
cd /UAT_Logs/CDCI_LOGS/SEEDADM
pwd
echo... (6 Replies)
I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Hello All,
I copied and pasted the "/etc/init.d/skeleton" file to a new one so I could create my own init script for a program.
Basically the ONLY edit I made to the skeleton "template" so far was to search and replace "FOO" with "snort".
*NOTE: I know there are a bunch of snort init scripts... (6 Replies)
Hi
As per my requirement when I run . ./file.sh am getting the following error
-bash:ELF: command not found
when i execute as ./file.sh it is getting executed.How to resolve this.
Thanks in advance. (3 Replies)
Hi,
I am having a shell script which has a while loop as shown below.
while
do
sleep 60
done
I am executing this script from Informatica ETL tool command task from where we can execute UNIX commands/scripts. When i do that, i am seeing 2 processes getting started for one script... (2 Replies)
Hi i wrote a script which dosent exists after executing any help
#!/bin/bash
netstat -ptlen | grep 10000
if ; then
echo "Hive Thrift server is running"
exit 0
else
echo "Hive Thrift server is down Trying to Bring up the service" | mail -s "ALERT" team@domain.com
`nohup hive... (7 Replies)
Guys,
How can we know whether a script has been executed successfully or not ?
We dont have any log directories, and we are not given a chance to modify the script. Could someone help me out with this Thanks (2 Replies)
Hi
Script not getting executed via cron but executes successfully when executed manually. Please assist
cbspsap01(appuser) /app/scripts > cat restart.sh
#!/bin/ksh
cd /app/bin
date >>logfile.out
echo "Restart has been started....." >>logfile.out
date >>logfile.out
initfnsw -y restart... (3 Replies)
I need to execute a shell script kept in unix machine from windows. User id, password area available.
For eg.
There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS.
Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Dear all
I would like to capture who executed a script to a script's variable (i.e. testing.sh), so I can save it to a log file.
testing.sh
#! bin/ksh
user=`<< code here >>` // get the info below in RED color
<<main logic>>
echo "$user execute testing.sh on `date`" >> testing.log
... (2 Replies)