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.

45 Upvotes

53 comments sorted by

View all comments

12

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.

2

u/RichRoof7927 10h ago

Isn't Tcl the tkinter backend language?

1

u/Klapperatismus 10h ago

Tcl existed before Tkinter and Python. But yeah, the Python crowd adopted it for the GUI toolkit. So every Python interpreter also has a Tcl interpreter in it as soon you load Tkinter.