Hacker News new | ask | show | jobs
by xenophonf 1703 days ago
A die-hard tcsh user myself, I mourn the end of an era, but has anyone done serious scripting in the C shell? I jokingly call it a sin in the eyes of the LORD, but seriously, it really, really sucks compared to even just the POSIX shell. It's probably time for me to finally give into Bash or zsh or something equally modern. Might be nice to get access to all of those shell completion hooks some tools have—not because tcsh doesn't offer custom completions, but because most tools don't target it. And so it goes.
6 comments

I am sad to hear FreeBSD is changing root from tcsh to sh (FreeBSD moved from csh to tcsh a while ago).

It was one of the things that made FreeBSD unique. I guess the got sick of hearing this question: "can I change the root shell to bash ?". I think they were the last holdout of the BSDs.

But to me, if you care what root's shell is, you are doing something wrong by using root way too often.

It is an absolutely trivial thing. Nobody should be making decisions about whether to use FreeBSD based on such trivialities.

That said, it really was damned annoying. I like to port my software to AIX, FreeBSD, Linux/glibc, Linux/musl, NetBSD, macOS, OpenBSD, and Solaris. All of them use a Bourne-like root shell except FreeBSD, and every time I go to upgrade a FreeBSD VM or build a new one I seem to always trip over that at some point. If I used FreeBSD regularly I wouldn't care as much--I'd change the default, or know how to achieve what I want more directly. But not being familiar with FreeBSD, I always end up in a root shell poking around trying to remember how upgrades work, which tools I need to find documentation for, etc, and end up cursing csh for compounding the mental burden.

From my perspective, changing the default root shell is a benefit, albeit very minor. Though, if FreeBSD (and NetBSD and OpenBSD, for that matter) began publishing official VM images, that'd be worth so much more to me.

> if FreeBSD (...) began publishing official VM images, that'd be worth so much more to me.

They do: ftp://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/

Even back when most people I knew used tcsh interactively, any significant scripting we did was for korn shell. It's been so long I don't remember what would have been so bad about tcsh scripting, but since we all made that choice I assume we would have agreed with you.
The surprisingly-"smart" completions are the only thing I really notice about zsh vs. bash, but AFAIK you can add the same functionality to Bash if you like. Ditto the git-related prompt modifications, like showing the current branch or whether your working dir is dirty, which is kinda nice—you can configure that sort of thing in bash, as well.

You can do all kinds of fancy stuff with zsh (especially via something like oh-my-zsh) but it bloats it and slows it down too much for my liking. Maybe if I were trying to work on a machine with no GUI, I'd go for that sort of thing. As it is, I don't need a battery level graph or load monitor or whatever, always visible in my terminal.

It's a sad state of affairs that when people think zsh they think "battery status".

The most important thing about zsh you should think of is "no need to quote variable expansion".

Tom Christiansen's essay "Csh Programming Considered Harmful" was commonly passed around the early internet and lists all the reasons why scripting in csh is terrible. I always considered csh purely for interactive use (where it was light years ahead of sh) and switched to ksh (or perl back in those days) for scripting.

http://harmful.cat-v.org/software/csh

Ready to use simple ZSH setup for the rescue:

https://vermaden.wordpress.com/2021/09/19/ghost-in-the-shell...

> has anyone done serious scripting in the C shell?

I recall SAP created used CSH/TCSH for its scripts but I am not sure they still do it.

zsh + oh my zsh + https://starship.rs/ is my pitch to anyone looking to upgrade their shell.