摘要:
#!/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 阅读全文
摘要:
#!/bin/bash# Redirecting stdin using 'exec'.#exec 6<&0 # Link file descriptor #6 with stdin. # Saves stdin.exec 0< data-file # stdin replaced by file "data-file"read a1 # Reads first line of file "data-file".read a2 # Reads second line of file "data-file.&q 阅读全文