1846713 Members
3525 Online
110256 Solutions
New Discussion

Re: shell script

 
Scott Gilchrist
New Member

shell script

I downloaded a script from the web that sets an oracle variable or sid from a list of possible databases. I want to run the script when the oracle dba logs on to the server. If i place the script name in the .profile it runs a subshell and the exported variables are lost when the script exits. If I run the script from the command line like this it works '. ./scriptname'. Is there a way to run the script at login and set environmental variables in the current shell?
5 REPLIES 5
Curtis Larson
Trusted Contributor
James A. Donovan
Honored Contributor

Re: shell script

Add the line, . ./scriptname, to your .profile
Remember, wherever you go, there you are...
Scott Gilchrist
New Member

Re: shell script

When I put. ./scriptname in the . profile I get the following error .profile [37]: 1: Parameter not Set

../scriptname -> .profile [37] ../scriptname not found

alias ss=". ./scriptname" -> sh: 1: Parameter not set
James A. Donovan
Honored Contributor

Re: shell script

Is this script in the users home directory? If not then you need to specify the path to the script.

. ${PATH_TO_SCRIPT}/scriptname

e.g.

. /var/opt/oracle/scriptname
Remember, wherever you go, there you are...

Re: shell script

Just two things to check.

First of all check the options for your shell (you are running POSIX/Korn? If not then alias may not work).

Check for 'nounset' in the shell environment (either found by default as 'set -u' in the /etc/profile or your own .profile.

Our Oracle DBAs had set up a similar script and were flummoxed when they kept getting the same error.

Adam
Don't chuck bricks at cows.