- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Unix prompt doesn't show up correctly on CDE
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2005 07:56 AM
08-21-2005 07:56 AM
After pasting the below command on CDE terminal of hpux it doesn't comes up correctly.
PS1=`whoami`'@'`/usr/bin/hostname`': $PWD $ '; export PS1
After pasting above command i get below output:
$ '`/usr/bin/hostname`': $PWD $ '; export PS1
>
The setting for terminal is as mentioned as shown below:-
TERM=dtterm
TERMINAL_EMULATOR=dtterm
Can someone advise how to overcome this situation ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2005 08:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2005 08:56 AM
08-21-2005 08:56 AM
Re: Unix prompt doesn't show up correctly on CDE
export PS1="$(whoami)@$(hostname):"'${PWD}'""
The grave accents have been deprecated for about 10 years in favor of $(...) and for modern POSIX shells like ksh, bash and HP's POSIX shell, you can export and assign a value on the same line.
One problem with $PWD...it can get really lengthy when cd'ing into a long directory structure. Here's a technique that shows just the current plus the parent directory, usually enough to know where you are located:
export PS1="$(whoami)@$(hostname):"'${PWD##${PWD%/*/*}/}'" # "
Now to make this permanent (ie, set when you login), you must add this to .profile in your $HOME directory. This works for 'normal' logins using telnet or ssh. But since you mentioned CDE, you are likely starting dtterm sessions with CDE and all normal Unix profiles are ignored (/etc/profile and .profile, etc). This can be very confusing but it is the way CDE was designed, probably because very few CDE users would ever use a terminal interface since it is a graphics system (big smiley face...)
But you can fix this so all terminal windows will perform a 'normal' login:
echo "*loginShell:true" >> $HOME/.Xdefaults
Now when you start dtterm windows, you'll see the same login sequence that a telnet connection will see.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2005 11:25 AM
08-21-2005 11:25 AM
Re: Unix prompt doesn't show up correctly on CDE
I am not a system admin on this box so may not be able to edit .profile. Secondly i have been granted read only permission to .profile. Actually i have root privilege and can change it but i don't want to do it as it might violate policy of sys admin folks.
The other option was to put your script in a file in my home directory and execute it. I tried executing it but got no result.
Can you suggest a way to put in a file and execute it to get the desired output ?
Thanks,
Shiv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2005 12:39 PM
08-21-2005 12:39 PM
Re: Unix prompt doesn't show up correctly on CDE
export PS1="$(whoami)@$(hostname):"'${PWD}'" "
or
export PS1="$(whoami)@$(hostname):"'${PWD##${PWD%/*/*}/}'" # "
Just run vi and insert the above line into a file, perhaps called myprompt. Now because you're not permitted to change .profile, this change for your prompt won't be automatic. Each time you login, you must type:
. ./myprompt
NOTE: the above is: dot space dot slash myprompt This is called sourcing and what the first dot does is to run the command in the file. Since you have to run this file each time you login, you don't need to create the .Xdefaults file.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2005 01:29 PM
08-21-2005 01:29 PM
Re: Unix prompt doesn't show up correctly on CDE
I just tried and it worked. Thanks a lot for your help. You seems to be a unix guru :-).
By the way what is the meaning of "sourcing" on hpux .
It seems sourcing concept is not available on other unix such as solaris and aix.
Thanks in advance,
Shiv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2005 04:32 AM
08-22-2005 04:32 AM
Re: Unix prompt doesn't show up correctly on CDE
Most of these shells have the Bourne shell as their ancestor but in terms of standards, ksh, bash and HP's POSIX shell are all called POSIX shells and sourcing is common to all of them including Bourne. When you run a script (a file with shell commands in it), the normal method is to start another copy of the shell program (called forking a process) and the new shell actually runs your script. But any changes to the environment such as PS1 will be lost when the script is done and the subshell terminates.
So the concept of 'sourcing' was created to have the current shell read each line and process it as if you had typed it in from the keyboard. That's why if you leave out the single dot, nothing changes in your current shell.
Bill Hassell, sysadmin