84 karma · joined December 27, 2016
Thank you for the compliment btw.
rb () {
[[ $1 == -l ]] && shift
case $? in
0 ) ruby -e "STDIN.each_line { |l| puts l.chomp.instance_eval(&eval('Proc.new { $* }')) }";;
* ) ruby -e "puts STDIN.each_line.instance_eval(&eval('Proc.new { $* }'))";;
esac
}Of course, if you are an emacs user, more power to you with the emacs bindings.
https://gist.github.com/binaryphile/3cf01870516d5fffafbc84a0...
Whoever wrote the initial bash script was clearly in a rush. I don't hold that against anyone, but it makes it poor fodder for an example of why bash is "bad". In particular, for the kind of task illustrated, it's a far better choice than python and I say that as a (formerly) unabashed pythonista.
It takes some time to get chops in bash, especially since there's no culture of developing shareable libraries, but it's no harder to learn bash via stackoverflow/google searches than it is to learn python. Use python when you need data structures and objects. Use bash to automate what you would normally do on the command line. Is that so hard?
- adage cited in the Mythical Man Month