DaemonForums  

Go Back   DaemonForums > NetBSD > NetBSD Installation and Upgrading

NetBSD Installation and Upgrading Have trouble getting NetBSD on your toaster?

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 5th July 2009
nihonto nihonto is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 65
Default Nicer Prompt with ksh on 5.0

Hi there,

as I am trying out NetBSD 5.0 I would like to use a little more functional prompt in the ksh. My problem: ksh under NetBSD is fairly different from ksh under OpenBSD.

While under OpenBSD all I had to do was putting something like:

Code:
export PS1='$PWD $ '
in my ~.profile and

Code:
XTerm*loginShell: true
in my ~.Xdefaults, under NetBSD this doesn't work at all.

So, I know it's a question on a very low level, but I haven't found any working hint up to now: Can you give me a hint on how I can change the prompt of the ksh?
Reply With Quote
  #2   (View Single Post)  
Old 6th July 2009
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

Both NetBSD and OpenBSD have implementations based on pdksh, each has their own customizations.

PS1 on NetBSD's ksh doesn't support the special backslash characters that are supported by OpenBSD's ksh and GNU's bash.. but you're not making use of them.

Make sure you reload the .Xdefaults file, or restart X.
$ xrdb -load ~/.Xdefaults

Hope that helps.
Reply With Quote
  #3   (View Single Post)  
Old 6th July 2009
s0xxx's Avatar
s0xxx s0xxx is offline
Package Pilot
 
Join Date: May 2008
Posts: 192
Default

Do the command in the shell and it will become efective immediatelly.
Code:
$ cd /usr/src
$ 
$ export PS1='$USER@$HOST [$PWD] $'
s0xxx@nbsd5 [/usr/src] $
__________________
The best way to learn UNIX is to play with it, and the harder you play, the more you learn.
If you play hard enough, you'll break something for sure, and having to fix a badly broken system is arguably the fastest way of all to learn. -Michael Lucas, AbsoluteBSD
Reply With Quote
  #4   (View Single Post)  
Old 6th July 2009
nihonto nihonto is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 65
Default

Hey folks, thanks for your advice!

s0xxx, I put this in my ~.profile:

Code:
export PS1='@$PWD $'
But now I get this prompt:

Quote:
sushisushi@/home/nihonto $
The hostname ("-s") is doubled. Any idea why?
Reply With Quote
  #5   (View Single Post)  
Old 7th July 2009
s0xxx's Avatar
s0xxx s0xxx is offline
Package Pilot
 
Join Date: May 2008
Posts: 192
Default

Actually no idea. You don't even have the $HOST in PS1 (if what you wrote is correct). Try logging out, and in again.
__________________
The best way to learn UNIX is to play with it, and the harder you play, the more you learn.
If you play hard enough, you'll break something for sure, and having to fix a badly broken system is arguably the fastest way of all to learn. -Michael Lucas, AbsoluteBSD
Reply With Quote
  #6   (View Single Post)  
Old 7th July 2009
nihonto nihonto is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 65
Default

Quote:
Originally Posted by s0xxx View Post
Actually no idea.
So now we are two

Quote:
Originally Posted by s0xxx View Post
You don't even have the $HOST in PS1 (if what you wrote is correct). Try logging out, and in again.
I tried logging out and logging in - it doesn't help.

You are right, I don't have the $HOST in PS1 because $HOST has been set by default. The reason? I think, it's because I have the following entry in my /etc/rc.conf:

Quote:
hostname=sushi.my.domain
This is because afterboot (8) says:

Quote:
Check hostname
Use the hostname command to verify that the name of your machine is cor-
rect. See the man page for hostname(1) if it needs to be changed. You
will also need to change the contents of the ``hostname'' variable in
/etc/rc.conf or edit the /etc/myname file to have it stick around for the
next reboot.
Since then the prompt switched from simple "$" to "sushi$".

So, was this wrong?
Reply With Quote
  #7   (View Single Post)  
Old 12th October 2009
Gryph0n's Avatar
Gryph0n Gryph0n is offline
New User
 
Join Date: Oct 2009
Posts: 1
Default

I was facing the same issue here, where my hostname was getting arbitrarily inserted into the prompt.

The issue, i found out was the ".shrc" file in the home directory. This file pulls in another file "/etc/shrc". If you have a look at "/etc/shrc", you'll find it performs a lot of tomfoolery with PS1 (including inserting the hostname), editor keybindings, etc.

I didn't find anything useful being done by these scripts, so i renamed ".shrc" to ".shrc_old". That gave me back the prompt i wanted (without the hostname), and as a bonus my keybindings of the editor to vi also got picked up instead of being ignored.

FYI,

$ uname -spr
NetBSD 5.0.1 x86_64
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
changing custom prompt ksh for root. bsdnewbie999 OpenBSD General 7 1st April 2009 04:53 AM
Exec command in zsh prompt? bsddaemon General software and network 2 18th October 2008 09:37 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:10 AM.


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