Question

I have a command in a makefile for a project I am working on and I have no idea what the >& part in java -jar java-cup-11a.jar -parser mj -dump src/mjparser/mj.cup >& javacup.dump does.

The bash documentation says that is illegal (and so does my jenkins when I tried to automate this) but for some reason building on the work machines, this command is perfectly legal and only works this way. I have tried changing it to >&1 to make it a valid redirect but it breaks the command and it can't handle it.

Should the make command be changed to have surrounding quotes to allow it to execute as a single command? Why is my Jenkins treating this command differently than a similar environment?

Was it helpful?

Solution

>& is a bashism.

It redirects both the STDOUT and STDERR.

An equivalent to what you're using would be:

java -jar java-cup-11a.jar -parser mj -dump src/mjparser/mj.cup > javacup.dump 2>&1

which would work in sh and dash as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top