Search code examples
emacsspecial-characterseshell

How to add "^" as an argument to a command in emac's eshell?


I am trying to make a command-line calculator for use by a webpage I am making. But when I try to execute in eshell with java Calculate -exp 10^20^30 I get:

:s/20/30/
Wrong type argument: stringp, 106

But that same command works fine in the regular PuTTY terminal, wrapping quotations around 10^20^30 didn't work and neither did using 10\^20\^30. I can execute bash commands but found it convenient to use eshell because I can copy and paste easily from eshell within PuTTY.

Any help is appreciated.

Edit: Just realized that I could also run the command with no issue using M-x shell but still want to know how to put special characters in eshell if that is the issue.


Solution

  • I was able to assign ^ to a variable in the following way

    setq x $(string 94)
    

    You can then try

    java Calculate -exp 10"$x"20"$x"30
    

    Or use it directly

    java Calculate -exp 10$(string 94)20$(string 94)30