Which shell do you use?

When you copy the dot.mkshrc sample file (ugh, the FreeBSD porters have colourised some
parts of it?) to ~/.mkshrc then mksh will give you the username, hostname and current
working directory before the $ (or #). You can of course write your own, it’s just a
sample ;-)

Colourising that is rather easy and, in mksh (as opposed to, say, pdksh), comes without
side effects. The sample file starts the effective PS1 with ^A^M (i.e. control-a or ASCII
0x01, and control-m or \r or ASCII 0x0D). This enables a “magic mode” first known from
AT&T ksh88 which allows you to wrap your escapes into matching pairs of ^A, like you use
\[ and \] in GNU bash.

Since mksh, by urging from Dave Korn himself, now supports $'…', you can use
│ PS1=$'\1\r\1\e[7m\1$PWD\1\e[0m\1> '
or things like that (this is actually an example line from the manual page, not
a prompt I use, but it works like that too). The prompt from dot.mkshrc is much
more complex, for example it applies the replacing of $HOME with ~ similar to
GNU bash’s \w and, in addition to that, prevents the rest from being wider than
about a third of the display.

Also, you could send me your (GNU bash syntax) prompt per eMail and I’ll convert
it to mksh syntax for you (unless I get a bazillion eMails per day…) – you should
of course state if you want the whole directory (/home/foo/bar), \w (~/bar), or
just the last part, for example.

I will update the online versions of the manpage to match mksh-current right
after submitting here:
• https://www.mirbsd.org/man1/mksh or https://www.mirbsd.org/man/mksh.1
• https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh.pdf

It should be noted that I will *not* be monitoring this web forum, I just
stumbled across this thread (it was pointed out to me). There are support
channels (both IRC and eMail) documented.
 
what shell do you prefer

Kind of an opinion question. I was wanting to know what shell most people use. I have come from Linux so Bash is the norm but FreeBSD it is the csh.

thanks

[ merged with existing thread - Mod. ]
 
sizemj said:
Kind of an opinion question. I was wanting to know what shell most people use. I have come from Linux so Bash is the norm but FreeBSD it is the csh.

thanks

err. So because you come from linux you prefer bash? Just because the system has a 'default' shell does not dictate that you have to use it. Also FreeBSD user should default to ash not tcsh.

I use zsh and script in ash.
 
zsh here, for root as well. I've messed things up, but have always been able to fix the mess-ups with the toor account, which uses /bin/sh. Can someone give a scenario where toor couldn't save you?

zsh users who don't like to rehash may want to check out the options nohashdirs and nohashcmds.
 
@UNIXgod

When he has toor account available with /bin/sh shell, then nothing can hurt him, even rm -f /usr/local/bin/zsh ...
 
vermaden said:
@UNIXgod

When he has toor account available with /bin/sh shell, then nothing can hurt him, even rm -f /usr/local/bin/zsh ...

Never really used toor ( reverse root) .... I imagine it's a security risk to some degree to enable it.

I don't like messing to much with root. I guess I never found /bin/csh to be that disabling. It has shell !history and simple tab completions and reminds me that I'm running root with it's prompt. But to each their own.
 
UNIXgod said:
haha don't change root shell! lol to zsh even. You guys have way to much time on your hands.

Yeah, takes a real lowlife to su root and then chsh.

You can consider me the resident BSD badass. I have changed root's shell, don't have separate partitions for /var, /usr, or /tmp, and I have minfree set to 0 on almost all disks.
 
Pushrod said:
Yeah, takes a real lowlife to su root and then chsh.

You can consider me the resident BSD badass. I have changed root's shell, don't have separate partitions for /var, /usr, or /tmp, and I have minfree set to 0 on almost all disks.

Wow you rebel. Do you also duel boot your laptop to win98 as well or just run inside vm?

j/k =)
 
UNIXgod said:
Never really used toor ( reverse root) .... I imagine it's a security risk to some degree to enable it.

What security risk if both root and toor will have the SAME password?

That is the PURPOSE of toor account, as backup for root, or as a root account with alternative shell.
 
I use ksh93 (interactive + scripting) because I use AIX at work and it is included in the base install. However ksh88 is the default root shell. :(

I haven't heard of mksh either until I saw killersmurfs post but I was hoping he would have included ksh93 in his tests. From what I read ksh93 is meant to be faster then all the other sh compatible shells.

Many people critisize ksh93 for interactive use but I think its really good now with recent versions.

I'm just curious why people would use mksh over ksh93, is it for licensing reasons?
 
Blueprint said:
I'm just curious why people would use mksh over ksh93, is it for licensing reasons?

That was the original reason. Korn shell was not F/OSS originally and those who prefered it used pdksh( i.e. public domain ksh).. mksh somehow came from there through openbsd. korn didn't become open source until the end of the 90's. Also bash and zsh have incorporated modern shell feature originally found in the korn shell. zsh was directly influenced.
 
Sorry I probably should have asked if it's "still for licensing reasons?". I am aware of the history, and the reasons we have bash,zsh and pdksh. But since ksh93 has been opensource for a while and since mksh is a relatively new offering. Are people in this thread making the switch to mksh for licensing reasons or do they prefer it over ksh93 for other reasons?
 
One thing not mentioned with building static libs, is the penalty of using them. It's going to use more memory that way. If you're doing a lot of scripting in a memory contrained enviroment, a static build of bash/zsh/etc is not ideal. That and sh execution is faster despite an earlier claim to contrary. This is why the base system shell of Debian and Ubuntu have switch to the dash shell(Debian Ash) similar to FreeBSD's /bin/sh.

Personally, I use either zsh, or tcsh for an interactive shell and I hate working in bash. One it's more frustrating attributes for me is it's history-search-backward functions as it's not nearly as useful as tcsh's FreeBSD default and to get the same behavior in zsh just add
Code:
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
There is no identical behavior in bash although you can get close with some fiddling.

tcsh has many nice attributes too that many aren't aware of. For example,
Code:
set autolist
in your .cshrc/.tcshrc gives nice autolisting similar bash or zsh. Many more too, see tcsh(). A lot less memory than bash/zsh too although that may not be as important as it once was.

If I'm doing to heavy lifting with shell zsh is a easier IMO, but for me I've probably already resorted to use python. I just don't like typing a thousand lines in sh when I could do in 100 with python plus it's easier to read/maintain/debug.
 
Blueprint said:
Sorry I probably should have asked if it's "still for licensing reasons?". I am aware of the history, and the reasons we have bash,zsh and pdksh. But since ksh93 has been opensource for a while and since mksh is a relatively new offering. Are people in this thread making the switch to mksh for licensing reasons or do they prefer it over ksh93 for other reasons?

To be honest, I haven't tried ksh93. I suppose I should.

I'd been using bash out of dumb, lazy habit (it's the default on the OS X system I was on before switching to FreeBSD) and was looking for something lighterweight. killasmurf's recommendation of mksh spoke to my need/desire.

But to turn the question back on you, why ksh93 rather than mksh?
 
I have never liked Bash, but I have and will use it on Linux systems. I use TCSH for interactive shells and SH for scripts. I did switch to ZSH for a while. Since I try to keep it simple, I use TCSH. TCSH is already installed in the base and I don't have to install ZSH. All I do on a new system is copy my .tcshrc over to the new system and I'm done!
 
ckester said:
But to turn the question back on you, why ksh93 rather than mksh?

Well for me it makes sense to keep my life simple by using a shell that is available on all systems I may need to use in the future. Ksh93 is available on all the propriety unix systems, linux distros and FreeBSD.
 
I'm retired now, and the only systems I'm likely to use are my own. So portability is less a concern than it used to be. ;)

I did install ksh93 since my last post in this thread. One thing I notice right away is that it's bigger than mksh:

Code:
$ ls -l /usr/local/bin/ksh93 /usr/local/bin/mksh
-r-xr-xr-x  1 root  wheel  1222248 Jan  7 21:24 /usr/local/bin/ksh93
-r-xr-xr-x  1 root  wheel   210560 May 10  2010 /usr/local/bin/mksh

I've also been doing some web searches for benchmarking tests of shell and other scripting languages:

This site looks interesting, although I haven't given a close reading yet. Nor have I tried to run its tests myself.

Here are some benchmarking tests specifically for ksh and its workalikes.

Taking a different tack altogether, this one tries to evaluate the suitability of different languages for "script oriented programming".
 
Back
Top