You think you are seeing this behaving as you expect
In[1]:= f[x_?NumericQ] := RunProcess[{"echo", ToString[InputForm[x^2, NumberMarks->False]]},"StandardOutput"];
f[3]
but if you then do this
Print[FullForm[%]]
I believe you will understand that your function is returning a string, not a numeric value, and trying to "minimize a string" isn't going to work.
If you are running Windows then
f[x_?NumericQ] := ToExpression[StringDrop[RunProcess[{"echo", ToString[InputForm[x^2, NumberMarks->False]]}, "StandardOutput"], -2]];
Print[FullForm[f[3]]]
might be closer to what you want. And if you aren't running Windows then the StringDrop may need to be adjusted to match your local conventions.
I think there should be a much better way of doing what you are trying to do.