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

📄 reassign-stdout.sh

📁 ksh 实现的基于hpux下的性能数据以及故障的采集程序。可以作为新手练手使用
💻 SH
字号:
#!/bin/ksh # reassign-stdout.sh  LOGFILE=logfile.txt  exec 6>&1           # 将fd #6与stdout相连接.                     # 保存stdout.  exec > $LOGFILE     # stdout就被文件"logfile.txt"所代替了.  # ----------------------------------------------------------- # # 在这块中所有命令的输出就都发向文件 $LOGFILE.  echo -n "Logfile: " date echo "-------------------------------------" echo  echo "Output of \"ls -al\" command" echo ls -al echo; echo echo "Output of \"df\" command" echo df  # ----------------------------------------------------------- #  exec 1>&6 6>&-      # 恢复stdout, 然后关闭文件描述符#6.  echo echo "== stdout now restored to default == " echo ls -al echo  exit 0

⌨️ 快捷键说明

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