3 ms·
The shell gives this kind of behaviour already through pipes and commands like awk, sed, and dc. More natural translations of the calculations given might be
by ralph 14y ago
The shell gives this kind of behaviour already through pipes and commands like awk, sed, and dc. More natural translations of the calculations given might be
$ seq 100 | awk '{s += $0} END {print s}'
5050
$ seq 20 | awk -v s=1 '{s *= $0} END {print s}'
2432902008176640000
$ seq 5 | awk -v s=1 '{s *= $0} END {print s}'
120
$ seq 3 |
> awk -v s=1 '{s *= $0} END {print s}' |
> xargs seq |
> awk '{s += $0} END {print s}' |
> md5sum
fe9d26c3e620eeb69bd166c8be89fb8f -
$ seq 400 500 | awk '{s += $0} END {print s}'
45450
$