Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable in script and "su" command 1

Status
Not open for further replies.

ogniemi

Technical User
Nov 7, 2003
1,041
PL
I have a ksh script which is run as root user.

In variables section there is set a host dependent variable
DBCHANGE

This DBCHANGE is used for doing some simple modification in database.

This script is implemented on serveral hosts - on each one DBCHANGE is differnet one.


Question:

how to put this variable (from root env) to the following command executed in the script:

su - dbadmin -c 'db2sciprt $DBCHANGE'

to have it recognized in dbadmin env. I need to run "su -" to get full dbadmin env.

Is it necessary to put this variable to dbadmin env (to profile)???


thx in advance for a tip,
rm.
 
su - dbadmin -c [highlight]"[/highlight]db2sciprt $DBCHANGE[highlight]"[/highlight]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
thx PHV!

it couldn't be simpler!

how to understand the difference in putting the command in '' and "" in my example?

 
you helpded me so I am giving you a star.
 
how to understand the difference in putting the command in '' and ""
In your ksh man page pay attention to Quoting and parameter substitution.


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top