PS1 issue between Solaris and Ubuntu


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers PS1 issue between Solaris and Ubuntu
# 1  
Old 02-16-2011
PS1 issue between Solaris and Ubuntu

I'm relatively new to *nix, and have been playing around with my .profile. I've been using ksh as my shell. Specifically I've been playing with my PS1 prompt, and trying to make it look uniform across Ubuntu and Solaris. I've posted what I currently have below.

Code:
HOSTNAME=$(hostname) ; export HOSTNAME 
PS1='$USER@$HOSTNAME:$PWD> ' ; export PS1



Currently this works fine in Solaris 10 and 11 express if I connect via ssh or open a terminal on a console session, and with Ubuntu 10.04 and 10.10 if I connect via ssh - the problems is when I'm on an Ubuntu console (I've switched my main pc to ubuntu as a desktop os) all I get is my ksh "$" prompt. If I source my .profile then the PS1 prompt will work.

I've been scratching my head at this and finally decided to post - I'm sure it's a pretty simple/obvious issue I'm overlooking.

I've searched through these forums but didn't find a post that matched my issue, forgive me if I missed a post that addresses this.
# 2  
Old 02-16-2011
It's a simple issue of "which file gets read when". Bourne compatible shells usually only read .profile when they are an login shell. For all other invocations (eg. when it's a xterm/gnome-terminal/konsole window) it just reads .kshrc or .bashrc. That's where you want to put anything for interactive use, as those usually are read too for login shells.
This User Gave Thanks to pludi For This Post:
# 3  
Old 02-16-2011
I see. I was assuming by not using my .kshrc my .profile could house all my environment tweaks. This gives me a new direction to look in. Thanks pludi.
# 4  
Old 02-17-2011
Are you using ksh on Ubuntu? My guess is you are using bash, in which case it will need to be in .bash_profile

I use Kubuntu and my .bash_profile runs when I log into the desktop.

Just my tuppence worth.

Andrew
# 5  
Old 02-17-2011
I am using ksh on Ubuntu. I had learned to use it first with Solaris, then when I started using Ubuntu I decided to install and just keep with it for now. I'll eventually learn to use bash, but for now I'm trying to learn more administration type things and the differences in them between Solaris and linux (specifically Debian/Ubuntu) without losing focus by trying to learn too many things at once.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Help changing the PS1 prompt in Solaris

Hi, I need help changing PS1 in Solaris. I tried this: MYPROMPT="> " PS1=$LOGNAME@$HOSTNAME:${PWD}$MYPROMPT (NOT SURE WHY IT'S HIGHLIGHTED HERE) export PS1 My problem is that $PWD is not working, when I get the prompt and I change directories, the prompt is not displaying the current... (17 Replies)
Discussion started by: curiousmal
17 Replies

2. Shell Programming and Scripting

Issue with Single Quotes and Double Quotes for prompt PS1

Hi, Trying to change the prompt. I have the following code. export PS1=' <${USER}@`hostname -s`>$ ' The hostname is not displayed <abc@`hostname -s`>$ uname -a AIX xyz 1 6 00F736154C00 <adcwl4h@`hostname -s`>$ If I use double quotes, then the hostname is printed properly but... (3 Replies)
Discussion started by: bobbygsk
3 Replies

3. Ubuntu

ubuntu 9.10 virtual console issue

i'm having a frustrating issue with virtual consoles on my ubuntu 9.10 setup i was having trouble accessing the virtual consoles at all (no visible display) so i installed XDM and set it as the default X login manager) now when i hit ctl-alt F1-F6 instead of the usual getty (login prompt) i get... (0 Replies)
Discussion started by: hopper195
0 Replies

4. Ubuntu

Installation issue while installing ubuntu

Hi All As i m trying to install ubuntu on my virtual PC where h/w confg is as 5GB didk n 512 mb RAm. after selecting mode option, and after pressing F6 after that screen shows some msg. And not goes to next step. What is the problem n wht i shall do?? Please provide me solution (3 Replies)
Discussion started by: sunray
3 Replies

5. IP Networking

Ubuntu LAN connectivity issue

System: Dell Desktop w/ 2 SATA drives running Ubuntu 9.10 that uses 2 ethernet cards, 1 for internet connectivity and another to interface the machine with a high voltage power supply which supports ssh and EPICS controls. Second Ethernet card is connected to a NetGear WNR3500 router, the VME... (0 Replies)
Discussion started by: henslewm
0 Replies

6. Programming

Ubuntu 9.04 issue

i have been tyring to install the Ubuntu OS 9.04 ,some how i failed to install it. i actually downloaded the OS from Download Ubuntu | Ubuntu i got the image file i tried to burn it by using nero, it susscessfully burned the image but when i insert the cd into drive and restart my system... (5 Replies)
Discussion started by: MrUser
5 Replies

7. Ubuntu

Ubuntu OS 9.04 issue ..

i have been tyring to install the Ubuntu OS 9.04 ,some how i failed to install it. i actually downloaded the OS from Download Ubuntu | Ubuntu i got the image file i tried to burn it by using nero, it susscessfully burned the image but when i insert the cd into drive and restart my system its... (1 Reply)
Discussion started by: MrUser
1 Replies

8. Ubuntu

Ubuntu Graphic Quality Issue?

Okay I have my computer dual booted with Ubuntu 9.04 and Windows Vista, when I play a game on Vista such as Soldier Front or Quake its smooth and very enjoyable, but when I try to get a simple game such as Scorched 3D, its glitchy, choppy, and the background seeps through to the game (I get a... (9 Replies)
Discussion started by: phoxly
9 Replies

9. IP Networking

Issue with /etc/hosts file under ubuntu

I think terminal outpu is better than long words so: I rebooted my laptop but no success... It's the same for all entry i added... Any ideas ? PS: I'm under ubuntu 9.0.4 edit: hostnames can't start with a number, using c4507 for example works. (0 Replies)
Discussion started by: nekkro-kvlt
0 Replies

10. Ubuntu

This an Ubuntu or Dell issue?

I have a dell poweredge sc430 (what ever that is). Came cheap with an 80 gig sata hard drive. So maybe a year later I bought a 250 gig sata drive for backup (with rsynch from cron). Rsynch works fine. But now the machine won't reboot without me manually pressing the F1 key. I see a... (3 Replies)
Discussion started by: salmobytes
3 Replies
Login or Register to Ask a Question

Featured Tech Videos