Splash 2020 conf is happening this week
2020.splashcon.org1 pointsby rgrau0 comments
while rlwrap -o -S'>> ' tr a-z A-Z ; do :; done
Gives you the "do X while it succeeds. stop when it returns non-0" semantics. unhist () {
alias $1=" $1"
}
unhist unhist
unhist fzf
unhist rghist #custom command that greps .zhistory,... foo |
bar |
baz
You don't have to use backquotes, AND, it allows you to comment line by line, because there's no backslash messing with the parser. #!/bin/sh
$*
that's my `~/bin/noglob` file, so when I call a zsh script from bash that uses `noglob`, it doesn't blow up. docker save $image | bzip2 | ssh "$host" 'bunzip2 | docker load' echo "${1:-${env_var:?I need a value for that!}}" &2=+/~x!/:\:x:!100
I wrote a little explanation of it, in case anyone is
curious about how it works: https://github.com/kidd/arraylangs-index/blob/master/noteboo... if (is_foo()) {
return 1;
}
can be cleared with `d%.` from the beginning of the first line. #!/usr/bin/env sh
browse_url() {
firefox http://github.com/$1/issues/$2
}
issue=$(curl https://api.github.com/repos/$1/issues |
jq -r 'map([(.number|tostring), .title] | join(" | ")) | join("\n")' |
dmenu -i -l 10 |
awk "{print \$1}")
browse_url $1 $issue
Although the `| join("\n")` part could be done in a more idomatic way with just `[]`, sometimes the manual way are still clearer to me: map([(.number|tostring), .title] | join(" | "))[] foo="ls -las"
$foo
"$foo"
for zsh to split words, `setopt SH_SPLIT_WORDS`.
Usually, those scripts are written by people who didn't learn the "weird tricks", and use global variables (they didn't learn that `local` creates local variables), for example.
In bash, many times the "dumb way" takes 10 times more lines, and it's probably buggier than the "smart tricky way". So, in the end it's your choice what side you pick, and when to stop. Or, use a "real programming language" (I hate when people say this LOL)
After a while, you get a bit of stockholm syndrome, and you're just fine with bash as an orchestration language, and lean into unix principles. I accept its limitations, and I think it keeps me on my toes as it repels bloat.
idk if you were expecting an answer, but bash lives in this liminal space in the tower of languages that is worth a thought.