Get Python command line output when called from a bash script
bash, python, shell, ubuntu
Solution
The proper solution would probably use `logging` as proposed in a comment.
In the meantime, you have to redirect both the standard output and the standard error stream in order to capture the normal output as wall as any error reported by your script:
#!/bin/sh
python recordSound.py >> logfile.log 2&>1
See one of the many web pages on that topic to explore the various redirection available from a shell script.
In addition, if you need both login and live view on the console, use the `tee` standard command:
#!/bin/sh
python recordSound.py 2&>1 | tee logfile.log
Problem
This may be a super simple question. I am calling a Python script on an Lubuntu OS (Cubietruck) via a shell script. This is to automate the process on start up (I want to maintain this process). Is there a simple way to view the output from Python? At the moment the Python script runs in the background, with no terminal. I have some errors that need checking. The script is: ``` #!/bin/sh python recordSound.py ``` Thanks in advance.