OS is ubuntu12.04. I wrote a python program main.py, and wanted to run it easily. So I created the following shell script called run.sh.
#!/bin/bash
python main.py & >/dev/null 2>&1
And executed this command chmod u+x run.sh.
However, when I ./run.sh, the python program's output is still there in the terminal.
But this can work: ./run.sh >/dev/null 2>&1. But this way is against my original intention, since it's too complex to use.
I wonder why this could happen. And how can I achieve my intention?
If you want to run script at the background try this:
python main.py >/dev/null 2>&1 &
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With