$ docker ps | rb drop 1 | rb -l split[1] $ docker ps | perl -anE 'say $F[1] if $.>1' perl solved this problem a long time ago, people
Except that in your example, the first line is coherent English, and the second line is just... well... code.
Show HN: Rb – Turns Ruby into a command line utility
61–70 of 79 posts
Re: Show HN: Rb – Turns Ruby into a command line utility
#62Re: Show HN: Rb – Turns Ruby into a command line utility
#63It makes me a little uncomfortable that they're using curl|bash for something as simple as "put this 10-line script somewhere in your $PATH," especially when the script involves sudo (to move into /usr/local/bin). Sure, it's easy to inspect the script and see that it's not doing anything malicious, but it makes install processes like this, where it'd be incredibly easy to, seem normal.
That said, brew install foo is a normal part of many development workflows, which essentially just curls a file from someone else's git repo.
Re: Show HN: Rb – Turns Ruby into a command line utility
#64It makes me a little uncomfortable that they're using curl|bash for something as simple as "put this 10-line script somewhere in your $PATH," especially when the script involves sudo (to move into /usr/local/bin). Sure, it's easy to inspect the script and see that it's not doing anything malicious, but it makes install processes like this, where it'd be incredibly easy to, seem normal.
I've [submitted a PR][2] to inline the install script in the README.
Re: Show HN: Rb – Turns Ruby into a command line utility
#65It makes me a little uncomfortable that they're using curl|bash for something as simple as "put this 10-line script somewhere in your $PATH," especially when the script involves sudo (to move into /usr/local/bin). Sure, it's easy to inspect the script and see that it's not doing anything malicious, but it makes install processes like this, where it'd be incredibly easy to, seem normal.
Re: Show HN: Rb – Turns Ruby into a command line utility
#66It makes me a little uncomfortable that they're using curl|bash for something as simple as "put this 10-line script somewhere in your $PATH," especially when the script involves sudo (to move into /usr/local/bin). Sure, it's easy to inspect the script and see that it's not doing anything malicious, but it makes install processes like this, where it'd be incredibly easy to, seem normal.
It's such a common pattern too. I can't believe people are still doing this and it's generally acceptable.
Am I way off base here?
Re: Show HN: Rb – Turns Ruby into a command line utility
#67Earlier quoted context omitted.
It's such a common pattern too. I can't believe people are still doing this and it's generally acceptable.
I mean, if you think about it, any time you run any installer, whether via brew install, apt-get install, or an .exe or .msi, you're effectively running someone else's unknown code on your system, often as a superuser (e.g. with sudo apt-get install). Is there a significant difference here? At least in this case you could potentially download the shell file and read it before you run it, unlike with a binary executab…
Most recent discussion: https://news.ycombinator.com/item?id=17636032
Re: Show HN: Rb – Turns Ruby into a command line utility
#68Earlier quoted context omitted.
echo hello world | ruby -pe '$_.capitalize!' printf 'hello\nworld\nhello\n' | ruby -le 'puts STDIN.to_a.uniq ps | ruby -lane 'BEGIN { b = 0 }; b += $F[0].to_i; END { print "sum of PIDs: #{b}" } select whatever column you want, to sum up. Really what Ruby needs is a flag that adds some capabilities to NilClass, so that these BEGIN blocks aren't needed.
If this was an attempt at showing this tool is unnecessary, you just did the opposite. Each of your examples use different flags, inputs and print methods. The last is particularly good at proving the point!
Re: Show HN: Rb – Turns Ruby into a command line utility
#69It makes me a little uncomfortable that they're using curl|bash for something as simple as "put this 10-line script somewhere in your $PATH," especially when the script involves sudo (to move into /usr/local/bin). Sure, it's easy to inspect the script and see that it's not doing anything malicious, but it makes install processes like this, where it'd be incredibly easy to, seem normal.
Yeah, and it's not even getting the code from an official source; it's coming from a random bit.ly link [created by a contributor][1]. I've [submitted a PR][2] to inline the install script in the README. [1]: https://github.com/thisredone/rb/pull/5 [2]: https://github.com/thisredone/rb/pull/8
Re: Show HN: Rb – Turns Ruby into a command line utility
#70The second I start wanting a bash pipeline, probably around the third pipe, I scrap it immediately and move to using a text editor to write a script. Because if I'm wanting a pipeline, I'm also going to want to store it, and transmit it over the network, and manage it, and put it down and come back to it later. All things perfectly manageable inside a PORO. Bundler even has an inline mode, so you can put everything i…
Don't you loose the easy threading that's inherent in a pipeline of processes though? I love ruby but for throw away jobs I'd be more likely to do it on the command line than a ruby script simply because it would be quicker for me to write and run in a shell. Unless I'm wrong at the very least you wouldn't have to deal with the GIL.