Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'improved version:' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
improved version:
Authored by: SOX on Jul 09, '07 10:40:23AM
Here's an improved version
alias calc perl\ \-ne\'\$bb\=\$x\;\$z\[\+\+\$i\]\=\$x\=eval\(\$_\)\;print\"\[\$i\]\\t\$x\\n\"\;\$y\=\$bb\'
This defines three variables $x, $y, and @z. results of the previous two commands, plus a stack of all the previous results.

>calc
27+18
[1]     45
3.3+7
[2]     10.3
$y             # the second to last result value
[3]     45
17+14
[4]     31
$x+9          # use the last result value
[5]     40
$z[2]-1       # use the very second result value
[6]     9.3
"@z"           # see the whole history
[7]      45 10.3 45 31 40 9.3


[ Reply to This | # ]