[neomutt-users] math evaluation with bc+dc

Sven Guckes neomutt-lists at guckes.net
Tue Apr 10 03:11:49 CEST 2018


* Pietro Cerutti <gahr at gahr.ch> [2018-04-10 00:57]:
> With [1] I can [do]:
> https://github.com/neomutt/neomutt/pull/1135
>
>    macro index,pager <f3> \
>    ':set pager_index_lines=`dc -e "50 $pager_index_lines -p"`<enter><redraw-screen>'

for those who have "bc" (binary calculator) installed:

    echo $pager_index_lines-50 | bc

untested, though, as i havent applied the patch yet.

caveat:
"bc" requires BC_ENV_ARGS
to point to a config file:
export BC_ENV_ARGS=$HOME/.bcrc

all i have there is this:
    scale=10

as bc shows a copyright message by default
and does not load the math library,
i am using this ehll alias:

    alias bc='bc -l -q'  # libmath + quiet

enjoy!

Sven

-- 
BC calculating PI to thousand and ten thousand digits
$ echo 'scale=1000; 4*a(1)' | bc -l
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1473 bytes
Desc: not available
URL: <http://mailman.neomutt.org/pipermail/neomutt-users-neomutt.org/attachments/20180410/f8c38259/attachment.sig>


More information about the neomutt-users mailing list