I wanted bc under win32. So this one-liner helps me do far more than calc.exe:
C:\>pp -o bc.exe -e "print eval \"@ARGV\"" C:\>move bc.exe %systemroot%\system32\ C:\>bc (1500 * 1.5 - 500)/2 # ... whatever
Thanks to PAR.


Replies are listed 'Best First'.
Re: bc.exe - trivial one-liner
by kaif (Friar) on Jun 10, 2005 at 23:11 UTC

    I personally am a fan of perl -ple'$_="> ".eval'. This is probably the most common script I write. Of course, your code above has the advantage of being transferrable to a system without Perl.

      Or
      c.bat: perl -ple "$_='> '.eval"
      in my cmd shell.
      -- allan
Re: bc.exe - trivial one-liner
by PhilHibbs (Hermit) on Jun 17, 2005 at 13:14 UTC
    What is pp?

    I have a similar widget, it's a perl script that reads the clipboard, evaluates each line, and stuffs the results back into the clipboard again. You can find it at Clipboard transform keys. I write my expressions in Notepad, and have the script bound to Ctrl-Shift-* so I just cut the lines I want evaluating, hit the keys, then paste the results back into the notepad.

Re: bc.exe - trivial one-liner
by spacewarp (Pilgrim) on Jul 13, 2005 at 18:08 UTC
    That's so simple.. it's so incredibly wrong! I love it! 8)

    Spacewarp

    DISCLAIMER:
    Use of this advanced computing technology does not imply an endorsement
    of Western industrial civilization.
Re: bc.exe - trivial one-liner
by perlmoth (Hermit) on Jul 13, 2005 at 12:26 UTC
    I got confused by this. When you wrote "Thanks to PAR", I thought that you were thanking another monk who gave you the idea for this. I didn't realise that you meant the PAR application, which this snippet requires.