通过isatty:
if (!isatty(fileno(stdout))
{
// redirected to a file or piped to a process
}
Run Code Online (Sandbox Code Playgroud)
欺骗的一种方法是开始,而不是重定向script.现在,所有转到'tty'的内容(包括你输入stdin的内容以及发送到输出的内容)都被发送到一个名为typescript的文件.
| 归档时间: |
|
| 查看次数: |
1195 次 |
| 最近记录: |