Operating System - HP-UX
1833461 Members
3106 Online
110052 Solutions
New Discussion

Re: Problem with the Shell

 
nagendra_3
Advisor

Problem with the Shell

I have the root access on one of HP-UX server.

I am having problem executing commands from my dollar prompt.

I always have to do a sh .profile ( on other systems i can do . .profile )

to execute java i have to do ./java Instead of doing java

Can one you help me solve this. Do i need to change my .profile or .kshrc ??

thanx,
Nag
Knowledge is Power
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: Problem with the Shell

Hi:

The need to enter '.java' instead of just 'java' reflects that dot ('.') isn't in your PATH. This is intentional, desired, and recommended! It is stronger security than placing '.' (the current directory) in your PATH.

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: Problem with the Shell

You can change your local .profile to set and export PATH

PATH=${PATH}:./
export PATH

However, it is normally considered a serious security issue to include ./ in root's PATH.
If it ain't broke, I can fix that.
nagendra_3
Advisor

Re: Problem with the Shell

Thanx for your message. That was an example i have given. There is some problem with my current shell.

1. If i open file say vi test.txt
2. Close it
3. then do r vi

I exepect that vi test.txt to be executed, which happens in all the other systems..
I get this error

"sh: fc: Cannot access or open the history file."

I created and set the appropriate permissions to .sh_history file

Knowledge is Power
A. Clay Stephenson
Acclaimed Contributor

Re: Problem with the Shell

My best guess is that you did not create the .sh_history file in this use's actual home direcory or this user does not have write permission in the home directory.
If it ain't broke, I can fix that.
nagendra_3
Advisor

Re: Problem with the Shell

Thanx all. The problem is solved. I Found that i was logging in using the ksh shell.

after i changed to to sh shell in the /etc/passwd file. It started working.

Knowledge is Power
James R. Ferguson
Acclaimed Contributor

Re: Problem with the Shell

Hi (again) Nag:

One final comment based on your last post. *NEVER* change the default shell for root in '/etc/passwd'. It should always (*only*) be:

/sbin/sh

...which is the Posix shell with static libraries. Failure to specify this shell may lead to an unbootable system. For normal users of the Posix shell, use the dynamically linked version found in '/usr/bin'. Resource consumption is thereby minimized.

Regards!

...JRF...