Reputation: 1195
I want to put all errors inside a file and prevent errors and success messages from printing on the screen. I only want to store the error message.
When I do this like the code below, the errors and success messages are shown on the screen and also inside the error.out
file.
git ls-remote "$GIT_SSH_URL/$REPO.git" 2>&1 > /dev/null | tee error.out
Upvotes: 0
Views: 585
Reputation: 13210
Get rid of the 2>&1 > /dev/null | tee error.out
part first. 2>&1
combines the errors and the output, which you don't want, and tee
prints the input it gets, which you also don't want.
> /dev/null
suppresses output, and 2> error.out
sends errors to the file.
Upvotes: 1
Reputation: 15471
Try this:
git ls-remote "$GIT_SSH_URL/$REPO.git" 2>file.log 1>/dev/null
Upvotes: 1