I write the Stata do-file and run it with a script code under the Ubuntu system. The .sh file with the following contents: It will generate a log file with the name of mydofile.log after running the .sh code. My question is how to specify the path and name of this log file? Answer You could redirect stdrr and stdout