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 16th June 2008
bsdnewbie999 bsdnewbie999 is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Default Is bash included in OpenBSD?

What terminals are available in OpenBSD for a newly installed system? Is there a port for bash and how do i change the default terminal to bash?
Reply With Quote
  #2   (View Single Post)  
Old 16th June 2008
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

Quote:
Originally Posted by bsdnewbie999 View Post
What terminals are available in OpenBSD for a newly installed system? Is there a port for bash and how do i change the default terminal to bash?
Default is Korn Shell. It is a OpenBSD "fork" of the public Korn Shell not to be mistaken with ATT Korn Shell and MidnightBSD Korn Shell .
Bash is available as a package. I do not think that Bash is very popular among BSD users and particularly not popular among OpenBSD users.
The part of the base system is Bourne shell of course because of Posix standard and I think C shell. I personally use Korn shell so I never bother to check.

Last edited by Oko; 16th June 2008 at 02:39 AM.
Reply With Quote
  #3   (View Single Post)  
Old 16th June 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by bsdnewbie999 View Post
What terminals are available in OpenBSD for a newly installed system?
  • the Korn shell (ksh(1)).
  • the C shell (csh(1)).
  • the restricted Korn shell (see the discussion for -r in ksh(1)).
  • the Bourne shell (sh(1)).
Note that with the last two, these are simply copies of /bin/ksh.
Quote:
Is there a port for bash...
Yes, see the following list of shells found in packages/ports:

http://openports.se/shells
Quote:
...and how do i change the default terminal to bash?
See the manpage for chsh(1).

This is also covered in Section 10.17 of the FAQ:

http://openbsd.org/faq/faq10.html#rootshell

Once you become comfortable with editing the password file, you can change the shell directly.
Reply With Quote
  #4   (View Single Post)  
Old 16th June 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

Just to chime in, bash is _n_o_t_ a terminal it is a shell.

Programs such as xterm are terminal emulators, the command line level interface through virtual teletypes when you first start the machine without X are 'virtual' consoles (not all that much different from a user point of view).


The shell runs in the console or terminal and should hopefully be fairly indifferent to which of them it runs in ;-)


PS

outside of bash specifics most things people expect of bash are doable in OpenBSDs pdksh implementation. A shell is mostly a shell for the most part unless you want to compare the other end of the pond.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #5   (View Single Post)  
Old 16th June 2008
marcolino's Avatar
marcolino marcolino is offline
Real Name: Mark
Custom Title Maker
 
Join Date: May 2008
Location: At the Mountains of Madness
Posts: 128
Default

Speaking as a long-time user of bash, who has only recently (since 4.2) switched to OpenBSD's ksh, there is nothing I could do in bash that I can't do in ksh.

That's one less port to have to install after a fresh system install.
__________________
That's nothing a couple o' pints wouldn't fix.
Reply With Quote
  #6   (View Single Post)  
Old 16th June 2008
lvlamb's Avatar
lvlamb lvlamb is offline
Real Name: Louis V. Lambrecht
Spam Deminer
 
Join Date: May 2008
Location: .be
Posts: 221
Default

Install http://openports.se/sysutils/checkbashisms
and run your bash scripts through it.

If you want to be portable, you can run [pd]ksh with the POSIX options, much like the /bin/sh link in Linux does.

And, beeing OpenBSD stock, ksh code is audited!
__________________
da more I know I know I know nuttin'
Reply With Quote
  #7   (View Single Post)  
Old 16th June 2008
ai-danno's Avatar
ai-danno ai-danno is offline
Spam Deminer
 
Join Date: May 2008
Location: Boca Raton, Florida
Posts: 284
Default

Quote:
Originally Posted by marcolino View Post
Speaking as a long-time user of bash, who has only recently (since 4.2) switched to OpenBSD's ksh, there is nothing I could do in bash that I can't do in ksh.

That's one less port to have to install after a fresh system install.


And that's nothing to scoff at- I believe you could call it a 'best practice' to keep your servers as lean as possible on the application installations. If you can accomplish what you need with what's already installed... then do so.

The other thing is that the rest of the OBSD community (as a whole, anyway) uses the default KSH... so you would be in better company using KSH instead.
__________________
Network Firefighter
Reply With Quote
  #8   (View Single Post)  
Old 17th June 2008
marcolino's Avatar
marcolino marcolino is offline
Real Name: Mark
Custom Title Maker
 
Join Date: May 2008
Location: At the Mountains of Madness
Posts: 128
Default

Quote:
Originally Posted by ai-danno View Post
And that's nothing to scoff at- I believe you could call it a 'best practice' to keep your servers as lean as possible on the application installations. If you can accomplish what you need with what's already installed... then do so.

The other thing is that the rest of the OBSD community (as a whole, anyway) uses the default KSH... so you would be in better company using KSH instead.
Add to that the ease of upgrading from one release to the next. Ports can be deprecated and removed, causing all sorts of configuration problems. At least if you keep to using the base, when something changes, it will be well-documented, with any necessary changes plainly spelled out. Just take a look at any Upgrade Guide.
__________________
That's nothing a couple o' pints wouldn't fix.
Reply With Quote
  #9   (View Single Post)  
Old 17th June 2008
lvlamb's Avatar
lvlamb lvlamb is offline
Real Name: Louis V. Lambrecht
Spam Deminer
 
Join Date: May 2008
Location: .be
Posts: 221
Default

OpenBSD as one of the best upgrading mechanism in the *nix world.

pkg_add -ui (man packages)
make update clean (man ports)
and
setting your FETCH_PACKAGES you would first grab the binary update if it exists instead of spending CPU time re-inventing warm water.
__________________
da more I know I know I know nuttin'
Reply With Quote
Old 18th June 2008
bsdnewbie999 bsdnewbie999 is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Default

How do i enable this option ( [rooot @ user]$ ) to ksh like in linux does?
Reply With Quote
Old 18th June 2008
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

$ man ksh
/PS1
n
Reply With Quote
Old 19th June 2008
marcolino's Avatar
marcolino marcolino is offline
Real Name: Mark
Custom Title Maker
 
Join Date: May 2008
Location: At the Mountains of Madness
Posts: 128
Default Colorized ksh prompt

Just as an example, here is(are) the relevant line(s) from my .kshrc
Code:
export PS1='\[^[[1;36m\]\u\[^[[1;37m\]@\[^[[1;32m\]\h\[^[[0;34m\]\
(\l)\[^[[0m\]:\[^[[0;31m\]\w\[^[[0m\]\$ '
I highly suggest you do a Google search for color ksh prompts for more info.
__________________
That's nothing a couple o' pints wouldn't fix.
Reply With Quote
Old 19th June 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by marcolino View Post
Just as an example, here is(are) the relevant line(s) from my .kshrc
Code:
export PS1='\[^[[1;36m\]\u\[^[[1;37m\]@\[^[[1;32m\]\h\[^[[0;34m\]\
(\l)\[^[[0m\]:\[^[[0;31m\]\w\[^[[0m\]\$ '
As an addendum, I don't deal with ANSI colors on a frequent basis, so remembering all the appropriate sequences isn't something I attempt. Plus, changing or simply debugging the above string has its own set of problems -- especially months, if not years after I originally wrote the code.

My suggestion adding to marcolino's example is to break the string further down into more manageable chunks. What I do is the following:
Code:
green='^[[01;32m'
yellow='^[[01;33m'
blue='^[[01;34m'
no_color='^[[0m'
prefix="${green}\u${yellow}@${green}\h${yellow}:${blue}\w"
char="${yellow} $ ${no_color}"
export PS1="${prefix}${char}"
FWIW.
Reply With Quote
Old 20th June 2008
marcolino's Avatar
marcolino marcolino is offline
Real Name: Mark
Custom Title Maker
 
Join Date: May 2008
Location: At the Mountains of Madness
Posts: 128
Default

Let me say that ocicat is correct. Ideally, one should have a simple, easily-read and -maintained config file.

Having said that, I have had the same prompt for 10 years or so. The only time I had to delve back into the escape codes and ANSI colors was when I switched to ksh from bash. Once I figured out how to get the colors I wanted, I did not take the time to clean it up with variables. Shame on me and my laziness.

Once I get the time, I will probably do so. However, with the way my time has been lately, that probably won't be for a while.

But, yes, I advise to break the codes down into variables like ocicat said.
__________________
That's nothing a couple o' pints wouldn't fix.
Reply With Quote
Old 30th July 2008
bsdnewbie999 bsdnewbie999 is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Default

Quote:
Originally Posted by ocicat View Post
As an addendum, I don't deal with ANSI colors on a frequent basis, so remembering all the appropriate sequences isn't something I attempt. Plus, changing or simply debugging the above string has its own set of problems -- especially months, if not years after I originally wrote the code.

My suggestion adding to marcolino's example is to break the string further down into more manageable chunks. What I do is the following:
Code:
green='^[[01;32m'
yellow='^[[01;33m'
blue='^[[01;34m'
no_color='^[[0m'
prefix="${green}\u${yellow}@${green}\h${yellow}:${blue}\w"
char="${yellow} $ ${no_color}"
export PS1="${prefix}${char}"
FWIW.
I don't find my .kshrc file. Can you paste your .kshrc file here? Last thing, where should i put it ?
Reply With Quote
Old 30th July 2008
scottro's Avatar
scottro scottro is offline
Real Name: Scott Robbins
ISO Quartermaster
 
Join Date: Apr 2008
Location: NYC
Posts: 652
Default

I have a VERY dated Stupid Korn Shell tricks which goes through some colorizing.
http://home.nyc.rr.com/computertaijutsu/ksh.html

These days, with work being mostly in Linux, I'm used to bash again. On FreeBSD, I still tend to use zsh. Unfortunately, in Fedora at least (my main workstation) sh doesn't seem to be completely POSIX compliant, and I try to make my scripts usable on AIX as well. However, there's another shell, dash, which is supposedly completely POSIX compliant, pretty much like the FreeBSD sh.
Reply With Quote
Old 30th July 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Tcpdump Spy
 
Join Date: Apr 2008
Location: Netherlands
Posts: 2,243
Default

Quote:
Originally Posted by bsdnewbie999 View Post
I don't find my .kshrc file. Can you paste your .kshrc file here? Last thing, where should i put it ?
If the file doesn't exist, the create it.
.kshrc should be in your home folder.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Old 30th July 2008
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 3,318
Default

Quote:
Originally Posted by bsdnewbie999 View Post
I don't find my .kshrc file.
Studying the ksh(1) manpage would be a wise use of time.
Reply With Quote
Old 31st July 2008
bsdnewbie999 bsdnewbie999 is offline
Package Pilot
 
Join Date: May 2008
Posts: 145
Default

i added .kshrc file but it doesn't run at startup. I need to run . .kshrc everytime when i start gnome-terminal.

I add the line PS1 to both .profile and .kshrc and it is still the same.
Reply With Quote
Old 31st July 2008
BSDfan666 BSDfan666 is offline
Real Name: N/A, this is the interweb.
Banned
 
Join Date: Apr 2008
Location: Ontario, Canada
Posts: 2,223
Default

You don't need it in both .profile and .kshrc, the former is used by login shells.. the latter for interactive. (For the most part, a .profile is all you'll normally need..)

When you define something in your profile, you need to 'export' it.

PS1="..."
export PS1


or:
export PS1="..."

After changes, you need to login again... if this doesn't work, please post the relevant section of the files here in [code][/code] tags.
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
Good Bash/Scripting book? cwhitmore Programming 10 22nd December 2017 03:59 PM
xterm + bash: Make <DEL> delete char under cursor taylor_venable OpenBSD General 7 13th December 2008 11:53 PM
Changing shell to bash rex FreeBSD General 13 29th August 2008 03:20 AM
Can't use bash on chroot'd openssh environment jploh FreeBSD General 2 18th June 2008 02:12 AM


All times are GMT. The time now is 01:15 PM.


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