3 ms·
why not pipe the input through a few more commands? :-P bc -l -e "(2/3) * 3 - 2"
by knodi123 3y ago
why not pipe the input through a few more commands? :-P
bc -l -e "(2/3) * 3 - 2"
- 5e92cb50239222b 3y agoI don't know which system you're on, but GNU bc does not support this flag. On the other hand, bash and zsh support this: bc -l <<<'(2/3) * 3 - 2' edit: neither does busybox.
- knodi123 3y agoHuh. I assumed I was on standard versions of these kind of really old utilities. But you're on to something: bc -v bc 4.0.2 Copyright (c) 2018-2021 Gavin D. Howard and contributors Report bugs at: https://git.yzena.com/gavin/bc
- gibspaulding 3y agoLike this? $ echo "(2/3)*3-2" | bc -l > /dev/null && echo "0"
- seanhunter 3y agoFirst prize would be if you could write a pipe which meaningfully combines bc, cc, dc, fc, nc and wc. No other commands allowed.