Cannot redirect script output

I am using Bamboo to run a script that compiles our source code. We use a custom developed compiler that is called from this script. The compiler displays a compile log as output, which the script redirects to a text file using the method below:

call compiler >compilelog.txt

The output works fine when run from the command line, however when I execute the script in Bamboo, the log output never gets redirected. If I look at the log created by Bamboo, a '1' is entered before the output is redirected as shown below:

call compiler 1>compilelog.txt

I guess my question is why is the '1' being placed in my script, which seems to be ignoring the output destination. It is very important that this log is saved in the text file that we are attempting to output it too, as we use this log for many reasons. Any help on how to surpass this issue would be greatly appreciated.

Thanks!

Jason

1 answer

1 accepted

0 votes
Accepted answer

Bamboo puts 1 to your output to store stdout to your file.

This allows to catch stderr and prints it in the bamboo logs.

Make sure that your compiler prints to stdout instead stderr

You may also try:

call compiler 1>compilelog.txt 2>&1

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 10 hours ago in Featured Groups

Are you managing your users efficiently?

Hi everyone, I am Marek, a Senior Product Manager for Crowd   Server and Data Center   here at Atlassian. I would like to spark a discussion about challenges you have with managing use...

74 views 1 2
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you