0

Is there any way to export all the output of set -x to a file? my exercise is to use set -x do some functions like mkdir and touch and export all the output to a file.

Thanks

Roey Haim
  • 73
  • 2
  • 9
  • `bash -x` outputs stuff to standard error, so you could run a sub-shell and redirect its stderr to a file. – Mechanical snail May 29 '13 at 20:16
  • @Roey you could save everything you run via script -a session.log -- just run that one you login and you start the script/session. It will save each and every command and its output into the logfile specified – Nitin4873 May 30 '13 at 04:25

1 Answers1

2
$ (set -x; echo hello) &> foo.txt

$ cat foo.txt
+ echo hello
hello

Example

Zombo
  • 1
  • 62
  • 391
  • 407