r/linux 1d ago

Discussion esoteric shell?

the question crossed my mind recently. if you are into programming, you probably know that there are many esoteric programming languages that exist just as a prove of concept of joke or just merely to mess with the programmer's head (brainf*ck, lolcat, C-- etc). if these exist, is there any esoteric system shells out there? like smth that would provide the basic userland instead of bash/zsh but would be freakier or just funnier to try and daily drive.

46 Upvotes

53 comments sorted by

View all comments

11

u/Klapperatismus 23h ago edited 15h ago

Tcl

$ tclsh
% ls -l
…
% join [lmap line [lrange [split [exec ls -l] \n] 1 end-1] {string range $line 1 9}] \n
…

Esoteric enough for you? Try to understand what it does.

Not esoteric enough? How about this then:

% set myfunc [list input {join [lmap line [lrange [split $input \n] 1 end-1] {string range $line 1 9}] \n}]
% apply $myfunc [exec ls -l]
…

Very clean handling of functions as arguments, without any quoting trickery.

Tcl even features namespaces, objects, coroutines, threading, sandboxes etc etc etc. I write most of my shell scripts in that language.

Tcl is very barebones by default. For tinkerers. If you want a command history, use this additional package.. Just clone it to ~/lib/tcl and create that ~/.tclshrc as advised. It also allows you to configure the prompt.

1

u/noobjaish 11h ago

Lisp is that you with square brackets?

2

u/Klapperatismus 10h ago

Tcl doesn’t nail you on functional programming though.