I have a script that stores the output of commands, functions, and other scripts in a log file.
I want to avoid capturing user input.
The line that is in charge of storing the output of the commands to a logfile is this one:
$command 2>&1 | tee /dev/tty | ruby -pe 'print Time.now.strftime("[%s] ") if !$stdin.tty?' >> "$tempfile"
If the command is a function or a script that asks for user input and prints out those data, that input is stored in temporary file. I would like to avoid that since I don't want to capture sensible data.
I can't modify the commands, functions that I'm wrapping.
bash -c 'echo "say something: "; read -u0 var; echo "you said: $var"; ' | tee /dev/tty >> tempfileand see what you get like that, or if you remove theecho you said...To pick the sensitive inputs out of the log, you'd to have some way to recognize them from among everything else. And that sounds impossible to do in general.command='read foo'vscommand='read -e foo': only the latter will log input). There's not really a lot you can do since it's the command itself that merges user input into its own output.