Operating System - HP-UX
1748156 Members
4189 Online
108758 Solutions
New Discussion юеВ

Re: ksh minor annoyance - 'literal' PS1?

 
cmac
Occasional Advisor

ksh minor annoyance - 'literal' PS1?

Hello all,

This is a relatively minor problem but I haven't been able to get a fix and it has become a matter of principle(!).

In short, when I su to some of my accounts, instead of having a correctly set PS1, I get the literal values e.g.:

${USER}@${HOST}[${ORACLE_SID}] $PWD >

Logging in directly to the accounts shows the expected prompt. These are all ksh accounts, each with a .profile which exports ENV=$HOME/.kshrc

.kshrc is responsible for exporting PS1. Both profile and kshrc are executable. What am I missing?

Thanks in advance...
cam
7 REPLIES 7
Dennis Handly
Acclaimed Contributor

Re: ksh minor annoyance - 'literal' PS1?

>when I su to some of my accounts

Do you do "su -"? If you don't, you shouldn't expect any prompt changes.

Or it appears that PS1 may not have been quoted correctly?

In any case, why make a large prompt. I only have "$ " and I put the path in the window banner.

>.kshrc is responsible for exporting PS1.

PS1 should be in .profile and all of your aliases/functions that you don't want for your scripts should be in .kshrc. Of course you need the complex pattern for ENV.

>Both .profile and .kshrc are executable.

These don't need to be executable since they are sourced.
Oviwan
Honored Contributor

Re: ksh minor annoyance - 'literal' PS1?

Hey

how can you change the window banner?

Regards
Dennis Handly
Acclaimed Contributor

Re: ksh minor annoyance - 'literal' PS1?

>Oviwan: how can you change the window banner?

I have escape sequences for xterm/dtterm and hpterm. I have a bunch of functions for cd, pushd/popd.
cmac
Occasional Advisor

Re: ksh minor annoyance - 'literal' PS1?

Sorry, should have clarified that I use su -

Not sure why quoting in PS1 would fail in su but succeed for a 'direct' login?

Points noted about kshrc and profile execute bit. As for length of prompt.. each to their own, I suppose. I work with many accounts across multiple machines and Oracle instances. This is the way I like to set things up.

As for PS1 should be in profile - assume this is a recommendation and not something that should technically make any difference.

Thanks for the response,
cam
cmac
Occasional Advisor

Re: ksh minor annoyance - 'literal' PS1?

Oviwan - there is a good link from:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1208171763348+28353475&threadId=433333

describing changing the xterm title (assume this is what you mean).
cmac
Occasional Advisor

Re: ksh minor annoyance - 'literal' PS1?

Still no fix for this if anyone has ideas... points still available!

Cheers,
cam
Dennis Handly
Acclaimed Contributor

Re: ksh minor annoyance - 'literal' PS1?

>Still no fix for this if anyone has ideas.

Can you echo the value of PS1?
The only way I can get your unexpanded string is with:
\${USER}@\${HOST}[\${ORACLE_SID}] \$PWD