Hacker News new | ask | show | jobs
by 3pt14159 3281 days ago
I'm ok at bash, but I do not default to complicated bash scripts for my needs. I make little reusable tools. For example I have a tool aliased that makes it easy to apply quick ruby code. For example

echo "345.44

544.50" | rg "€#{l}: €#{(l.to_f * 3).to_i}"

Produces the following output:

€345.44: €1036

€544.50: €1633

Based on this code:

https://gist.github.com/zachaysan/4a31386f944ed31a3f8a920c85...

I find it's much faster to be productive like this than it is to try to do the same with ruby -e because I really only want to manipulate single incoming lines. I don't want to have to write the looping code or the code that sets variables or what have you.

Also, sometimes it gets confusing what tools are just bash functions or alias and which are scripts, so if you ever forget what a tools definition is just type:

type toolname

As for actually answering your question, look at your friend's dotfiles on their github account to learn which tools and tricks they use and when you don't know how something works ask them questions. People will usually point you in the right direction.

1 comments

Any particular reason you don't use `ruby -p`? Looks like it's doing pretty much the same thing.