This is in continuation to the question in Infix form of PutAppend ( >>> ) does not work with variable.

I was trying to use

MakeExpression[RowBox[{lhs_, ">>>", rhs_String}], form_] :=
RowBox[{"PutAppend", "[", RowBox[{lhs, ",", rhs}], "]"}],
] /; ! StringMatchQ[rhs, "\"*\""]

In terminal, so that

out= "new"<>"file";

would send the expression into "newfile". However the suggested solution failed.

How do I use MakeExpression in a terminal session? Or otherwise use >>> in terminal for a filename stored in an expression?

  • $\begingroup$ "How do I use MakeExpression in a terminal session?" <-- Things typed into a notebook are stored as boxes. The conversion rules from boxes to expressions can be hacked (MakeExpression). Things typed into a terminal are just text. They're interpreted by the kernel's built-in parser, which cannot be changed or hacked. Generally, stuff relying on boxes will only work in notebooks and requires a front end. An example is the Notations package, which is not usable from the terminal. $\endgroup$ – Szabolcs Aug 12 '15 at 13:45
  • $\begingroup$ You might want to try UsingFrontEnd. $\endgroup$ – Silvia Aug 14 '15 at 7:46

To use Put or PutAppend with a filename saved in a string in terminal, one can use it in input form rather then >> or >>>, that is:




I found the answer in https://stackoverflow.com/questions/8853676 by Brett Champion.

While this solves my problem, I would still like to be enlightened as to how to use MakeExpression in a terminal.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.