Question

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

Was it helpful?

Solution

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

$ cat foo.txt
+ echo hello
hello

Example

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top