Home > Software engineering >  How to save results but don't show output in the terminal
How to save results but don't show output in the terminal

Time:10-24

I am trying to write a script that extracts wifi passwords. The problem is, I don't want it to show output before it's fully done.

from subprocess import check_output
raw = check_output('security find-generic-password -ga test > /dev/null 2>&1',\
shell=True)

If I suppress output like this, then even variables won't get any output for further uses. So how to suppress output, but save it in a variable.

CodePudding user response:

ping=$(ls >> output.txt)
rm -rf output.txt

Assume the above scenario. I am piping the sttdout to a file then removing the file. Result is the output is not seen.

  • Related