I’m trying to run an external program with arguments. The program can take different types of arguments, for instance
avl tip.avl
or avl < test.ops
<
the
"<"
does not get sent as an argument, but as an input after the program runs
No, that’s not right. It is passed as an argument, just as test_0.avl
and test_0.ops
are.
[…] the same as just running
avl
and then typingtip.avl
No, that is never what happens in the shell. The shell will pass tip.avl
as the first argument.
That said, it is your shell that special-handles the <
sign, as it would special-handle >
and |
. When you use ProcessBuilder
, that special handling will not happen. Your second invocation is equivalent to this in the shell:
avl '<' test_0.ops
This will disable the sepcial meaning of the <
. That’s not what you wanted here, of course.