⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reassign-stdout.sh

📁 Shall高级编程
💻 SH
字号:
#!/bin/bash# reassign-stdout.shLOGFILE=logfile.txtexec 6>&1           # Link file descriptor #6 with stdout.                    # Saves stdout.exec > $LOGFILE     # stdout replaced with file "logfile.txt".# ----------------------------------------------------------- ## All output from commands in this block sent to file $LOGFILE.echo -n "Logfile: "dateecho "-------------------------------------"echoecho "Output of \"ls -al\" command"echols -alecho; echoecho "Output of \"df\" command"echodf# ----------------------------------------------------------- #exec 1>&6 6>&-      # Restore stdout and close file descriptor #6.echoecho "== stdout now restored to default == "echols -alechoexit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -