1834429 Members
2399 Online
110067 Solutions
New Discussion

Shell ksh

 
SOLVED
Go to solution
Jose_129
Regular Advisor

Shell ksh

I cannot execute script in profile of a user. Script sybase.sh setting some variables.

# pwd
/sybase
# ll
total 128
-rwxrwxrwx 1 sybase sybase 832 Nov 14 2000 .cshrc
-rwxrwxrwx 1 sybase sybase 347 Nov 14 2000 .exrc
-rwxrwxrwx 1 sybase sybase 334 Nov 14 2000 .login
-rw-rw-rw- 1 sybase sybase 1088 Sep 11 10:39 .profileOLD
-rwxrwxrwx 1 sybase sybase 4064 Sep 11 10:47 .sh_history
drwxrwxrwx 3 sybase sybase 96 Sep 5 17:26 ASE-12_0
drwxrwxrwx 3 sybase sybase 96 Sep 5 17:28 FTS-12_0
drwxrwxrwx 4 sybase sybase 96 Sep 5 17:28 OCS-12_0
drwxrwxrwx 3 sybase sybase 96 Sep 5 17:29 SQLRemote
drwxrwxrwx 3 sybase sybase 96 Sep 5 17:31 SYSAM-1_0
-rwxrwxrwx 1 sybase sybase 0 Sep 5 18:03 js
drwxrwxrwx 2 sybase sybase 96 Sep 5 17:27 lib
-rwxrwxrwx 1 sybase sybase 588 Sep 11 19:12 sybase.old
-rwxrwxrwx 1 sybase sybase 455 Sep 11 19:13 sybase.sh



# cd /home/sybase/
# ll
total 80
-rwxrwxrwx 1 sybase sybase 832 Nov 14 2000 .cshrc
-rwxrwxrwx 1 sybase sybase 347 Nov 14 2000 .exrc
-rwxrwxrwx 1 sybase sybase 334 Nov 14 2000 .login
-rwxrwxrwx 1 sybase sybase 529 Sep 11 19:09 .profile
-rw------- 1 sybase users 1184 Sep 11 19:16 .sh_history

$ echo $SHLIB_PATH
ksh: SHLIB_PATH: parameter not set
Change password in way single user, beginning in multiuser way console
6 REPLIES 6
Sridhar Bhaskarla
Honored Contributor
Solution

Re: Shell ksh

Hi,

Put a "set +u" just before you call this script in your profile. "set -u" will print if there are any undeclared variables.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Rajeev  Shukla
Honored Contributor

Re: Shell ksh

By default SHLIB_PATH is not set so if you run
SHLIB_PATH=/sybase/ASE-12_0/lib:/sybase/FTS-12_0/lib:/sybase/OCS-12_0/lib:$SHLIB_PATH
coz $SHLIB_PATH is not set it says...
Just remove the last entry $SHLIB_PATH and keep it

SHLIB_PATH=/sybase/ASE-12_0/lib:/sybase/FTS-12_0/lib:/sybase/OCS-12_0/lib
and see if it works

Rajeev
Tim Adamson_1
Honored Contributor

Re: Shell ksh

To fix your problem you have to source the script so it sets the variables in your current environment. If you simply call the script, it will set it for the child process and when the child exits, the variable definition is gone.

Instead of:

# ./sybase.sh

try:

# . ./sybase.sh <<< Note the dot space


Also the permissions on those files are not very secure. Once you reslve the issue, make sure you take the extra step to secure the permissions on all the files in the directory.


Tim.
Yesterday is history, tomorrow is a mystery, today is a gift. That's why it's called the present.
Sridhar Bhaskarla
Honored Contributor

Re: Shell ksh

Hi,

Tim is right. I didn't try to download your profile as it is in zip format so I thought u had it correctly. If you are simply calling it like /home/sybase/sybase.sh, then those variables won't survive for the parent shell unless you source in the script as ". ./home/sybase/sybase.sh".

By the way you have to unset "set -u" too otherwise, it may throw errors.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Jose_129
Regular Advisor

Re: Shell ksh

A variable of scripts sybase.sh is defined:
SHLIB_PATH=/sybase/ASE-12_0/lib:/sybase/FTS-12_0/lib:/sybase/OCS-12_0/lib:$SHLIB
_PATH

I execute the command:
$ echo $SHLIB_PATH
/sybase/ASE-12_0/lib:/sybase/FTS-12_0/lib:/sybase/OCS-12_0/lib:

This good that obtains this result, Both points this good?
Change password in way single user, beginning in multiuser way console
Sridhar Bhaskarla
Honored Contributor

Re: Shell ksh

Hi Jose,

Put "set +u" at the beginning of your sybase.sh script. It inherits "set -u" from your .profile and throws out error.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try