Hacker News new | ask | show | jobs
by dekhn 1703 days ago
We once upgraded a major research department from csh to tcsh (while also migrating most users to bash). A senior leader complained that when they hit the up arrow, the last command they typed showed up.

I explained how to disable readline

4 comments

Why do people care what their default shell is, when you can just “exec csh” immediately upon logging in?

Was this kind of shell changing disabled? Maybe there’s no way of doing that exec automatically? Is there some advantage to having your shell of choice explicitly listed in /etc/passwd?

There's a long list of boring answers you probably don't care about involving "these are biomedical researchers using UNIX, not hackers", "complex legacy scripts that depend on default shells", and "enterprise compliance".
The second two sound quite interesting. I hadn’t thought about those at all.
I wonder what he was using the up arrow key for in the shell.
In those days people mainly used ! expansion. https://en.wikipedia.org/wiki/C_shell#History. I know many people who are incredibly good at using ! expansion to edit previous commands ("change that command 5 lines ago to rm -rf this other folder") but it's a bit of a footgun.
Depends how you use it.

If you just want to execute it then it is a footgun - using only the !command syntax.

If you use the !command:p syntax then you are just printing what command has been executed instead of invoking it.

Example.

    % uname
    FreeBSD
    
    % !uname
    uname
    FreeBSD
    
    % !uname:p
    uname
    
    %
Right, but the up arrow didn't get in their way, right? So why get mad?

I imagine that how it worked for them before is that the up arrow would move the cursor to the previous line into the output of the previous command, while feeding the arrow key escape sequences to the shell prompt as part of the command. IOW, a pretty useless and annoying key right? Why even press it? How did they notice readline?

from what I can tell he was looking hard for problems.

He also noticed that if you ran 9 "yes" commands on a 8 core machine, the CPU wasn't allocated in 8/9ths units (one process always got a lot less CPU). he was used to much more predictible CPU scheduler on multiprocessor systems (spoilt by TruCluster). Linux later adopted a better scheduler (fair share) so imho he was right on that one, even if "yes" is a terribly performance metric.

It seems the lesson here is that changing things out from under someone isn't a good look. What would have been the cost in not changing users' shells for them?
Everybody else has a worse shell.
Doesn’t the up arrow key show the last command executed?
That says a thing or too about habits. Was he pissed or was it just a light comment ?

I'd be sad to see an educated person refuse interesting new tricks (readline causes no regression or loss right ?)

It's delicate. The noob me chased after new tricks with much more enthusiasm than the current me. Over time, priorities change, and now I just want to get stuff done and for tools to get out of the way. I'd appreciate new tricks that bring quite a lot of benefit to my workflow, but the little tricks I'd rather let fly past me.

If the tools such as base environment changes way too often, I'd be annoyed as well - not because I don't know how to make the colours go away or set up the proper aliases - but the fact that I need to do it and pause my actual work.

I totally understand that, I'm not a young mind anymore, and I get that most of these are pointless superficial tricks. I spend most of my days venting about the state of computing (especially since web2.0 came and replaced a lot of stuff with bloated regressions in many offices)

But I considered readline a good addition, not a waste of time and neurons.

ps: I stopped using zsh/fish, my emacs theme is the vanilla theme.. you forget about these 'improvements', for real tasks they don't matter.

I work half as fast without fish completions. matters to some people
Maybe I shouldn't have included this comment after the `pointless superficial tricks` :)
Fish truly is superior for productivity.
It has its downsides unfortunately.
It is one of the saddest self-realizations in my old age that I am no longer excited about learning/perfecting my tools.

But as you say, tools must get out of the way...

he was pissed! and, really didn't like terminal colors when you ran 'ls' (so I showed how to unalias ls)

At this point I don't want to learn any new tricks, either. I'm sticking with bash for the rest of my life.

I would guess that he was mostly pissed that things "just changed" without being asked. While these sort of things like the up arrow seem like a no-brainer to many here, showing up for work on Monday and having everything just be different sucks. It's a bad experience, and I can't really blame him for being annoyed.

A lot of times people would be a lot more receptive if you show them "hey, you can use the up arrow like so if you want!" Then they can choose and adapt at their own pace if they want to, and they're in control of their own systems.

I told him (this guy was the chair of the informatics department at a major biomedical company) that I understood if he didn't like color ls, because it could be hard to see some colors on a terminal, but that if he wanted to disable arrow key history he was just crazy. Some things are just progress.
I've been trying to stick with bash for at least 20 years (I did have a brief tcsh phase before that) since a time when sticking with it meant having to install it on every unix system I touched. However, now that MacOS defaults to zsh, I'm starting to wonder if I should summon up the effort to change again.
I think the most noticeable difference is that `$foo` doesn't word-split unless you do `${=foo}`. Beyond that, I don't think one would notice they were using zsh instead of bash. In most ways, zsh is pretty much a superset of bash.
personally, I don't have interest in zsh because bash is the default shell in Linux, which is the UNIX system I use (I find mac's unix to be really a weird variant). Mac switching to zsh is just more evidence they're diverting from the mainstream.
> I find mac's unix to be really a weird variant

It's closer to BSD than it is to Linux. Not super similar, but closer, especially in ways one tends to notice on the command line.

It still sticks pretty close to BSD. I am seeing a ton of (entirely natural) similarity since I started seriously playing with FreeBSD
you're right, Mac OS X is a derivative of BSD but it also has significant Mach tech (like the linker).

I've used freebsd for years and I still find Mac OS to be the least useful UNIX.

Apple switched to zsh because newer versions of bash are licensed under GPLv3.
I know what the reason is. I don't care. I use GPLv3 and have no interest in an OS that doesn't. You can run bash on windows or compile it yourself on any platform. microsoft even distributes it with windows.
IIRC, MacOS had to ship with a fairly old version of bash by default because newer versions have a more copyleft license; I always assumed that their swap to zsh was because they wanted something both up to date and compatible in terms of the license (and the fact that most bash "just works" when you run it in zsh is a plus).
macOS is about as standard of a Unix as you can get, apart from Linux with coreutils.
what kind of research ? was it computing related or something really different ?

I'm quite shocked

I'm not 20 something either, I'm not chasing new shiny.. but a simple history access (arrows or search) is not an invasive disruptive toy feature..

alas

biomedical research, but the person I was helping "had written a kernel disk driver for VAX BSD back in the 80s" and I think they wanted things to more or less stay the same as BSD in the 80s. Which, as far as wishes go, isn't terrible.
yeah I guess he earned the right to have his ways :)
As always, there's an xkcd on this

https://xkcd.com/1172/

In my view all shells are quite good (for a given value of good).

If you have a problem with one or two shells but not all of them, then you might want to look within.