Using linux script command

The command scriptexecutes and writes logs.

( http://www.computerhope.com/unix/uscript.htm )

( http://linuxers.org/article/script-command-line-tool-recordsave-your-terminal-activity )

I use a command scriptto save commands and their output.

When you use the 'script', I print commands like the following.

$ script result.log
Script started, file is result.log
$ date
$ ls -la.
$ exit

Sometimes I want to use this command with a shell script.

So, I run as below.

$ script -c test.sh result.log

But the result .log has only output, it does not contain the command itself. I want result.log to include commands and output.

How can i do this?

thank

+4
source share
2

sh -x script, -x script.

script -c "sh -x ./test.sh" reult.log

:

+ date
Tue Dec 23 09:52:22 CET 2014
+ ls -la
+3
 set -o verbose

script script.

, .

​​, .

:

 set -x or set -v set -xv

-x - , .

-v -o verbose,

-xv .

0

Source: https://habr.com/ru/post/1568715/


All Articles