1829693 Members
7912 Online
109992 Solutions
New Discussion

Re: setenv: not found:

 
SOLVED
Go to solution
krizevac
Advisor

setenv: not found:

When I try to start the sapdba tool the system returns this message:
/home/user/.kshrc[23] : setenv : not found:

Any suggestion?
-*-
16 REPLIES 16
Andrei Petrov
Advisor

Re: setenv: not found:

Hi

.kshrc is executed by ksh. So you should use ksh syntax
#export VAR=bla/bla/bla
instead of csh
#setenv VAR /bla/bla/bla
Steven Sim Kok Leong
Honored Contributor

Re: setenv: not found:

Hi,

ksh uses export. It does not use setenv. To find out the currently running shell, execute:

# echo $SHELL

In your .kshrc, replace all the lines using setenv with export, and add the = (equal) signs eg.

Change:

setenv ORACLE_HOME /u1

to:

export ORACLE_HOME=/u1

Hope this helps. Regards.

Steven Sim Kok Leong
Peter Kloetgen
Esteemed Contributor

Re: setenv: not found:

Hi, you are using a wrong syntax for the kornshell:

var=value ; export var

or

export var=value

is the correct way. You used C- shell- syntax which is not understandable for kornshell.

You can also do command- substituting in kornshell:

var=$(command_to_execute)

or

var=`command_to_execute` # use backticks

Allways stay on the brigth side of life!

Peter
I'm learning here as well as helping
Krishna Prasad
Trusted Contributor

Re: setenv: not found:

maybe coping your .kshrc to .cshrc and changing your users default shell to csh will be a better solution for you. It all depends on the rest of the scripts, if any the user will use. I have seen some environments where the majority of the scripts for an application are written in the csh 'c' shell. If they are set-up the user to have a default csh cell or you may have to change all the scripts that are written in csh to ksh. Or you will have to make sure that the person that wrote the script setup it up correctly to run correctly no matter the environment of the calling shell.
Positive Results requires Positive Thinking
krizevac
Advisor

Re: setenv: not found:

What I have to modify to use correctly the sapdba tool ?

Thx.
-*-
Tom Geudens
Honored Contributor

Re: setenv: not found:

Hi,
To try it out, use
#csh [script you are trying to execute now]

Hope this helps,
Tom Geudens
A life ? Cool ! Where can I download one of those from ?
Sanjay_6
Honored Contributor

Re: setenv: not found:

hi,

Can you attach your .kshrc file

Hope this helps.

Regds
Peter Kloetgen
Esteemed Contributor

Re: setenv: not found:

Hi,

you have to change the way you are giving values to your needed variables like descripted in the first posting, or you have to change shells. If the /usr/bin/ksh is the login shell you have to make a /usr/bin/csh the loginshell and you have to make the entries in the $HOME/.cshrc- file. Then you can use the setenv- command to assign values to your variables.

You can change the loginshell with the chsh-command or by editing the /etc/passwd- file and then logging out and relogin the user.


Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Krishna Prasad
Trusted Contributor

Re: setenv: not found:

I see you are using SAP.

I am also in a SAP environment.

We have always used the csh environment for the oraSID user.

Please note my above post. I would keep using the csh shell for this user. The default user for this user in SAP is the csh shell. Everytime you upgrade SAP or install a new system SAP it will set the default shellback to csh. We found it much easier to keep the sidadm user and orasid user to csh.
Positive Results requires Positive Thinking
krizevac
Advisor

Re: setenv: not found:

In attachment th .kshrc file
-*-
Peter Kloetgen
Esteemed Contributor

Re: setenv: not found:

Hi,

the error doesn't occur in your .kshrc file. So you have to post the following files to let us find it there:

--> .dbenv_.sh or .dbenv_`hostname`.sh

--> .customer.sh


Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
krizevac
Advisor

Re: setenv: not found:

Requested files in attachment.
I've replaced the 'real hostname' with 'hostname'.
I haven't found the file .customer.sh.
-*-
Peter Kloetgen
Esteemed Contributor

Re: setenv: not found:

Hi,

sorry, I am not able to read your attachment correctly, but I found some sequences where a cshi- shell syntax is needed. So I agree with the others:

It is much more easy to change the shell for the user(s) which need to source the files in your last attachments, than to make a completely new script which uses ksh- syntax!
And the files you just attached use definitely csh- syntax, which is not compatible to a ksh.

So please change the shell from ksh to csh to avoid the shown mistakes. If you could post the attachment in the same format than the first one, perhaps i can read the complete attachment to find the errors exactly...

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
krizevac
Advisor

Re: setenv: not found:

In attachment the requested files
-*-
Deepak Extross
Honored Contributor
Solution

Re: setenv: not found:

Yup, your .dbenv_hostname.sh has "setenv" calls. Replace them with "export" calls as explained. That should fix it.
Peter Kloetgen
Esteemed Contributor

Re: setenv: not found:

Hi,

the only thing you now have to do is to find all "setenv- commands" and to replace them with

export var=value

This should fix your problems!

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping