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 24th February 2010
PleaseHelpAnewbie PleaseHelpAnewbie is offline
New User
 
Join Date: Feb 2010
Posts: 6
Thanked 0 Times in 0 Posts
Default Issue retaining PS1 setting.

Hello,

I'm extremely new to the BSD world and am having trouble with the PS1 retaining its settings after logging off and/or rebooting.

I put this: PS1="\d \t [\w]#"

It does change, but it doesn't stay permanent. I don't know why. What am I doing wrong to make it go back to default?

Please help me retain those settings by providing the correct steps or even files to edit.

Thank you all in advance for the help.

Kind Regards
Reply With Quote
  #2   (View Single Post)  
Old 24th February 2010
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,888
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by PleaseHelpAnewbie View Post
It does change, but it doesn't stay permanent
To be retained from one session to the next, this setting need to be written to ~/.profile. To do so,

$ PS1="\d \t [\w]#"
$ echo $PS1 >> ~/.profile

You can check to ensure that this has been saved by issuing the following command:

$ cat ~/.profile

The setting for PS1 should now appear at the bottom of the file.

Note that ending PS1 with a '#' is not necessarily following convention. All user accounts typically have a '$' prompt. '#' is reserved to designate the root account.

You can determine how you are logged into the system by issuing the following command:

$ whoami

If you are logged in as root, you really need to create a non-root account & use it exclusively. Logging into a system using the root account is not considered a best practice.

And while you are a newbie, you will save yourself much aggravation by taking the time now to study the FAQ:

http://openbsd.org/faq/index.html
Reply With Quote
  #3   (View Single Post)  
Old 24th February 2010
PleaseHelpAnewbie PleaseHelpAnewbie is offline
New User
 
Join Date: Feb 2010
Posts: 6
Thanked 0 Times in 0 Posts
Default Oh and...

Oh and I'm running OpenBSD on VirtualBox from Sun Microsystems.

Thanks
Reply With Quote
  #4   (View Single Post)  
Old 24th February 2010
PleaseHelpAnewbie PleaseHelpAnewbie is offline
New User
 
Join Date: Feb 2010
Posts: 6
Thanked 0 Times in 0 Posts
Default

Thank you. I'll be sure to do that.

Now my next mission. Colors in the terminal! Shouldn't be too bad.

Thanks again!
Reply With Quote
  #5   (View Single Post)  
Old 24th February 2010
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,888
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by PleaseHelpAnewbie View Post
Oh and I'm running OpenBSD on VirtualBox from Sun Microsystems.
In this situation, what needs to done is the same irregardless of any emulation used underneath.
Reply With Quote
  #6   (View Single Post)  
Old 24th February 2010
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,888
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by PleaseHelpAnewbie View Post
Now my next mission. Colors in the terminal!
If you are referring to coloring PS1, then you will need to familiar yourself with two things:
  • ANSI codes for color.
  • A text editor capable of inputting the escape sequence.
If you are referring to colorizing the output of ls(1), then you will need to install the colorls package as described in the following:

http://openports.se/sysutils/colorls

To install packages requires understanding OpenBSD's package system. Carefully study Section 15 of the FAQ in preparation.
Reply With Quote
  #7   (View Single Post)  
Old 24th February 2010
PleaseHelpAnewbie PleaseHelpAnewbie is offline
New User
 
Join Date: Feb 2010
Posts: 6
Thanked 0 Times in 0 Posts
Default

Yes the output of ls command is what I meant. I realize that regardless of a real or virtual machine it's technically the "same" too, I just wanted you to know my system is all.

Thank you man. I appreciate it.
Reply With Quote
  #8   (View Single Post)  
Old 24th February 2010
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 566
Thanked 14 Times in 13 Posts
Default

Quote:
Originally Posted by ocicat View Post
$ PS1="\d \t [\w]#"
$ echo $PS1 >> ~/.profile
The second line above doesn't look right to me. What needs to be done is to put the first line into the ~/.profile file.

Then again, it's always possible I'm missing something...
Reply With Quote
  #9   (View Single Post)  
Old 24th February 2010
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,888
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by IdOp View Post
The second line above doesn't look right to me.
Try it, & report back the results.
Reply With Quote
Old 24th February 2010
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 566
Thanked 14 Times in 13 Posts
Default

Quote:
Originally Posted by ocicat View Post
Try it, & report back the results.
After booting OpenBSD 4.6 on the other machine (to get ksh) it did what I expected:

a) the first line changes the prompt to the desired value

b) the second line puts some junk at the end of ~/.profile
In vi the junk looks like \d, a TAB, a couple of spaces and then [\w]#
which is not something the shell can understand.

c) logging in again with the new appendage on ~/.profile, the shell complains:

Quote:
Originally Posted by ksh
ksh: /home/myuserid/.profile[7]: d: not found
IOW it is looking for and not finding a command called d, which was invoked by the \d .

What am i missing?
Reply With Quote
Old 24th February 2010
PleaseHelpAnewbie PleaseHelpAnewbie is offline
New User
 
Join Date: Feb 2010
Posts: 6
Thanked 0 Times in 0 Posts
Default

I had to add it manually with vi
Reply With Quote
Old 24th February 2010
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,888
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by IdOp View Post
the second line puts some junk at the end of ~/.profile
My bad. You're correct in that what I provided was incomplete. What I should have specified is the following:

$ echo "PS1=$PS1" >> ~/.profile

I apologize for any confusion caused.
Reply With Quote
Old 24th February 2010
IdOp's Avatar
IdOp IdOp is offline
Too dumb for a smartphone
 
Join Date: May 2008
Location: twisting on the daemon's fork(2)
Posts: 566
Thanked 14 Times in 13 Posts
Default

ocicat, I too resemble this kind of brain-fart far too frequently. Glad it is all working now for PleaseHelpAnewbie.
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
I need help setting up queues. MarcRiv OpenBSD Security 6 17th November 2009 11:31 PM
7.0 to 7.1 retaining app. preferences etc. maxrussell FreeBSD Installation and Upgrading 11 15th May 2009 08:40 AM
Setting up nameservers paran0iaX OpenBSD General 11 13th March 2009 12:16 PM
Setting Up MPD benjgvps FreeBSD General 0 21st May 2008 12:20 PM
thanks for setting this up DraconianTimes Off-Topic 8 5th May 2008 08:14 AM


All times are GMT. The time now is 06:09 PM.


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