Does anybody know why this works with bash calculator (bc) in vim:
echo system ("echo 3+5 \| dos2unix \| bc -l") ---> output: 8
echo system ("echo 3/5 \| dos2unix \| bc -l") ---> output: .600000000000000
echo system ("echo 3*5 \| dos2unix \| bc -l") ---> output: 15
but this not:
echo system ("echo 2^5 \| dos2unix \| bc -l") ---> output: 25
echo system ("echo 3^5 \| dos2unix \| bc -l") ---> output: 35
This is used under cygwin in Windows.
What is the value of
&shelloption? It must be/path/to/cygwin/bash, not something ending withcmd.exe. The problem is that^is an escape character in windowscmd.exe, soecho 2^5is somewhat equivalent toecho 2\5resolving intoecho 25.If it is
cmd.exeadd a lineto your vimrc.
Note though that
echo 2^^^^5resolving toecho 2^5is somewhat strange (in plaincmd.exeit isecho 2^^5), but I saw very long discussion on vim-dev regarding escaping issues forcmd.exesome time ago, so it may be one of them. Should not happen on the most recent vim (or it is a bug).