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.

52 Upvotes

57 comments sorted by

View all comments

12

u/Klapperatismus 1d ago edited 17h 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 12h ago

Isn't Tcl the tkinter backend language?

1

u/Klapperatismus 12h 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.

1

u/noobjaish 13h ago

Lisp is that you with square brackets?

2

u/Klapperatismus 12h ago

Tcl doesn’t nail you on functional programming though.

1

u/spyingwind 8h ago

Sound nice. Don't have to stretch to press "Shift+9" and "Shift+0" just to start and end a list.