Debian Codegraph @

reassign-stdout.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # reassign-stdout.sh
3
4 LOGFILE=logfile.txt
5
6 exec 6>&1 # Link file descriptor #6 with stdout.
7 # Saves stdout.
8
9 exec > $LOGFILE # stdout replaced with file "logfile.txt".
10
11 # ----------------------------------------------------------- #
12 # All output from commands in this block sent to file $LOGFILE.
13
14 echoscip-shell system . . echo. -n "Logfile: "
15 datescip-shell system . . date.
16 echoscip-shell system . . echo. "-------------------------------------"
17 echoscip-shell system . . echo.
18
19 echoscip-shell system . . echo. "Output of \"ls -al\" command"
20 echoscip-shell system . . echo.
21 lsscip-shell system . . ls. -al
22 echoscip-shell system . . echo.; echoscip-shell system . . echo.
23 echoscip-shell system . . echo. "Output of \"df\" command"
24 echoscip-shell system . . echo.
25 dfscip-shell system . . df.
26
27 # ----------------------------------------------------------- #
28
29 exec 1>&6 6>&- # Restore stdout and close file descriptor #6.
30
31 echoscip-shell system . . echo.
32 echoscip-shell system . . echo. "== stdout now restored to default == "
33 echoscip-shell system . . echo.
34 lsscip-shell system . . ls. -al
35 echoscip-shell system . . echo.
36
37 exit 0