DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 21st September 2017
mefisto mefisto is offline
Port Guard
 
Join Date: Sep 2017
Posts: 20
Default SOLVED: ksh color coding prompt problem

Greetings all,

in order to have a reminder when switching to root, I am trying to colour code the prompts. It is working for the user, but not for root. I have copied the working prompt from the ~/.profile to the /root.profile:
Code:
export PS1='\e[0;31m\u@\h\e[00m:# '
but it does not work when I su to root. I have checked $TERM and it shows xterm.

Interestingly, when I log out of Openbox session and log in as root, the FVWM terminal shows the root's prompt correctly.

Any advice would be appreciated.

Kindest regards,

M

Last edited by mefisto; 23rd September 2017 at 10:13 AM.
Reply With Quote
  #2   (View Single Post)  
Old 21st September 2017
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,944
Default

The ~/.profile is sourced at login. If you want to use it with su(1), use su() with the -l option. Alternatively, if you require sourcing /root/.profile, install the sysutils/sudo package and use sudo with -i. The built-in doas(1) can provide a shell with -s, but it is not a login shell and will not source /root/.profile.
Reply With Quote
  #3   (View Single Post)  
Old 21st September 2017
mefisto mefisto is offline
Port Guard
 
Join Date: Sep 2017
Posts: 20
Default

Hi jggimi,

thank you very much, works just like you indicated. Any disadvantage creating an alias for su -l?

Kindest regards,

M
Reply With Quote
  #4   (View Single Post)  
Old 21st September 2017
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,944
Default

There are occasions when you might not want to use su() in a login shell, such as when executing something as a normal user (e.g.: a database owner) and you want or need your existing shell environment variables.
Reply With Quote
  #5   (View Single Post)  
Old 22nd September 2017
mefisto mefisto is offline
Port Guard
 
Join Date: Sep 2017
Posts: 20
Default

Hi jggimi,

thank you, that is a valid point.

Is there a way do mark the issue solved?

Kindest regards,

M
Reply With Quote
  #6   (View Single Post)  
Old 22nd September 2017
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 5,944
Default

I believe you may be able to edit the title by editing the top post, and then clicking on the "Advanced" button.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Color Prompt in OpenBSD. tetrodozombie Guides 18 13th April 2013 02:02 PM
Adobe's new open source font for coding J65nko News 3 28th September 2012 10:46 AM
Nicer Prompt with ksh on 5.0 nihonto NetBSD Installation and Upgrading 8 12th October 2009 08:49 PM
Opera Font and Dialog Color Problem roddierod FreeBSD General 4 26th September 2008 02:39 PM
what to do at mountroot prompt? Sunsawe FreeBSD General 13 5th June 2008 08:06 AM


All times are GMT. The time now is 08:21 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick