hammereditor
hammereditor

Reputation: 69

Linux: No output from a program in a .sh script

I am trying to execute a Windows program in Linux, and I want to get the output (stdout) from that process. I put this text into a .sh file: wine Blockland.exe ptlaaxobimwroe -dedicated -port 30000 >> consoleLog.txt It executed the program, but created a blank file. This command always works when directly executed in a Terminal window. So why isn't it printing the output to the file when in a .sh script?

Upvotes: 2

Views: 519

Answers (1)

siride
siride

Reputation: 209585

It could be sending output to stderr. To account for this possibility, try

wine Blockland.exe ptlaaxobimwroe -dedicated -port 30000 2>&1 >>consoleLog.txt

The 2>&1 bit redirects stderr (file descriptor 2) to stdout (file descriptor 1). Then it redirects stdout (which includes stderr output now) to your log file.

Upvotes: 1

Related Questions