I have remove.sh which contains:
rm -v test.tmp
And I have install.sh which contains:
script remove.log -c './remove.sh'
What can I do so that whether or not test.tmp exists, I don't see any rm related messages on the screen but see removed 'test.tmp' or rm: cannot remove 'test.tmp': No such file or directory in remove.log which the script command produces?
script -c remove.log 'your command' > /dev/null. Thescriptcommand will capturestdoutandstderrto your log file, and the redirection will suppress all terminal output from thescriptcommand. – larsks Feb 18 '12 at 00:06