Babashka – A Clojure for the grey areas of Bash
github.com
github.com
> Some English speakers use the word "babushka" [бaбушка] (the word for 'grandma' in Russian) to indicate a headscarf tied below the chin, as still commonly worn in rural parts of Europe.
However the author should be aware that most people would interpret "bab(a|u)shka" as "grandma" and not as a scarf. Which works too, I guess. Personally, I always think of a https://en.wikipedia.org/wiki/Matryoshka_doll (which is also sometimes called babushka) when I see this word...
The English word Viking became Japanese バイキング (baikingu), meaning "buffet", because the first restaurant in Japan to offer buffet-style meals, inspired by the Nordic smörgåsbord, was opened in 1958 by the Imperial Hotel under the name "Viking".
>ls | bb -i '(count input)'
ls | wc -l
>bb '(vec (dedupe input))' <<< '[1 1 1 1 2]'
send your input to `uniq` for chrissakes
>ls | bb -i '(filterv #(re-find #"README" %) input)'
just `ls * README * ` (there shouldn't be spaces around the * s but HN formatting doesn't like me)
like
come on, honestly.
If not, this isn't for you anyhow.
In other words, if I don't speak Clojure, why should I learn? This project hasn't convinced me it's worth it yet, but maybe it is?
The original tagline was "a sprinkle of Clojure for the command line". A user of babashka commented that this tool was exactly right for him to cover up the grey areas of bash (bash constructs he could not remember the syntax for). If you picture bash as a grey woman and Clojure as the headscarf to cover her grey hair, the metaphor might start to make sense.
This is a nice writeup of someone diving into GraalVM + Clojure at work:
https://gist.github.com/cldwalker/663c3e1a82dc2ccf9e53eb8f45...
In contrast, running code from an unaudited source (GitHub, NPM, etc.), or executing a binary from some random website, all less transparent yet just as dangerous, but for some reason raise way fewer eyebrows.
The main problem isn't malicious code, you can review the script after all, the main problem is the app making unwarranted assumptions about your install/distribution, then breaking things in the process.
https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-b...
What if, before "run what you downloaded", first perform a dry run and observe it while it is running.
set -x
curl https://example.com/setup.sh | bash -n
set +x
-x Execution trace-n Read commands but do not execute them
curl https://example.com/setup.sh | bash -vn
As for trying to hide commands from an execution trace, it is not possible to hide the set +x command. cat > 1.sh
echo visible
set +v
set +x
echo hidden >/dev/null
^D
cat 1.sh | bash -x
Output: + echo visible
visible
+ set +v
+ set +x
One can syntax check setup.sh before downloading it with -vn (or perhaps shellcheck). After downloading and reading it, one can observe it while it is running with -x.The truth is that people download and run shell scripts without reading them all the time. For example, how many people installing software packaged with configure scripts actually read the scripts. (Except in the event they do not work.)
Bash scripting is incredibly powerful but also terribly broken with horrible edge cases. E.g. if syntax, bash quoting, -print0, parsing strings with regexps... It's near impossible to build sound applications with bash.
Parsing output of almost any program breaks at _some_ point: https://dwheeler.com/essays/fixing-unix-linux-filenames.html
You need to know what data you are dealing with when writing shell scripts. bb does not aim to fix that. Just gradually improve.
https://www.arp242.net/curl-to-sh.html
HN discussion: https://news.ycombinator.com/item?id=21490151
$ bash <(curl ...
Seeing this in a README immediately indicates that the author has no idea what they're doing security-wise, and that I probably shouldn't trust their project.It's not like package managers are immune either: https://www.theregister.co.uk/2018/11/26/npm_repo_bitcoin_st...
https://www.seancassidy.me/dont-pipe-to-your-shell.html
https://sysdig.com/blog/friends-dont-let-friends-curl-bash/
https://news.ycombinator.com/item?id=12766049
Bonus points: serving a different script to people piping to bash, and those not:
https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-b...
This is just embracing complexity when scheme is a perfect fit, and already exists in multiple ways in the domain.
Did Gauche stop existing?
> Did Gauche stop existing?
Out of all the five people who ever heard about it, three probably stopped using it and for the rest, it may just be like it never existed - they've never heard about it.
Clojure on the other hand somehow managed to become third most popular JVM language and very popular alt-js language. Out of all PLs that can be considered somewhat esoteric, Clojure today is the most vibrant - it has more books, podcasts and conferences. More than Elixir, OCaml, Haskell, Elm, Purescript and even Rust.
Very few people used Guile, even before Clojure got some spotlight. So instead of whining why can't you be happy for the fact that people still want to use Lisp in 2020 at all?
It's madness. There's already several much better tools people should be using for these domains, but they seem to insist on importing their massive and bloated toolchain in instead.
There is a dependency on a Java VM implementation, GraalVM, and on a Small Clojure interpreter. That looks Node-ish to me, regardless of the application deployment model.
GraalVM has some kind of updater, "gu", that's looks reminiscent of npm:
https://www.graalvm.org/docs/reference-manual/install-compon...
Not sure what you're on about... any piece of software is going to be composed of smaller pieces. What's wrong with that?
> There is a dependency on a Java VM implementation
Only for developing it.
> GraalVM
GraalVM is many things. This is compiled using GraalVM Native Image which compiles JVM bytecode into a native binary executable. There is no JVM hidden away in that executable either.
> and on a Small Clojure interpreter
The fact that it uses a a library (by the same author) for interpreting Clojure - what exactly is the issue here? If he didn't separate that into a library it would be fine, but the moment it's modular it's an issue to you?
> GraalVM has some kind of updater, "gu", that's looks reminiscent of npm:
GraalVM includes a command-line utility and that means it has the NPM cooties...?
This is just embracing complexity when R5RS is a perfect fit, and already exists in multiple ways in the domain.
Did scsh stop existing?
Also you'd have to say R5RS -> R7RS is somehow a fall into complexity which makes absolutely no sense.
Scsh hasn't been updated for over a decade.
I appreciate the satire but I think compared to something like Guile, no one has answered what this does better beyond personal preference. And honestly, I don't see that alone as a good justification.
I could have a preference for using Matlab to bootstrap embedded devices but that doesn't make it a good idea.