4 ms·
It's feeding stdin to ruby code you specify on the command line, either as an array of lines, or repeated strings. So in: docker ps | rb drop 1 | rb -l split
by simonista 8y ago
It's feeding stdin to ruby code you specify on the command line, either as an array of lines, or repeated strings. So in:
docker ps | rb drop 1 | rb -l split[1]
The output of docker ps is passed as an array of lines to ruby, and the first line is dropped, and then that output is fed to ruby again, but line by line, so each line is split (which defaults to split on whitespace), and returns the second element. With parentheses for function calls it would be:
docker ps | rb drop(1) | rb -l split()[1]
- nerdponx 8y agoSo drop is just a Ruby function? This is a great idea, seems like a good application of Ruby's syntax.