tom*_*ums 2 linux arch-linux io-redirection
我期待运行命令并将它们的输出记录在一个临时日志文件中,以便稍后由不同的进程读取。
因此,例如: rc.d start ntpd > progress.txt
返回:
::Daemon scriptntpddoes not exist or is not executable.
我假设,因为这是一个错误,所以它不会被重定向,但是,有没有办法强制将所有内容重定向到文件?
您只重定向STDOUT到,progress.txt但错误通常会写入STDERR.
要重定向都STDOUT和STDERR来progress.txt试试:
rc.d start ntpd &> progress.txt
Run Code Online (Sandbox Code Playgroud)
如果您搜索io-redirection ,您将找到有关此主题的许多其他信息。