(no title)
ryanmjacobs | 1 year ago
pp open("|ls -lh /usr/bin/ls"){_1.read}
"-rwxr-xr-x 1 root root 135K Aug 30 04:57 /usr/bin/ls\n"
or to quickly print tabular data open("|column -t -s \\t", "w"){_1 << tsv_data}ryanmjacobs | 1 year ago
pp open("|ls -lh /usr/bin/ls"){_1.read}
"-rwxr-xr-x 1 root root 135K Aug 30 04:57 /usr/bin/ls\n"
or to quickly print tabular data open("|column -t -s \\t", "w"){_1 << tsv_data}
vidarh|1 year ago
ryanmjacobs|1 year ago
I use it for code like this:
Useful because it eliminates /bin/sh footguns (e.g. `md5sum hello&world` forking or `~john` expanding), plus you get kernel.spawn() options. `open("| ...)` only made sense for the second example.Anyway, I find "_1" more eye-pleasing than: