0

出力1と2をファイルと画面にリダイレクトする方法は?

command 2 1 > /tmp/log and 2 1 screen

ファイルと画面へのすべての出力

ありがとうございました

4

2 に答える 2

7

tee コマンドは、出力をファイルと tty の両方に送信します。

echo 'hi there'  2>&1 | tee outputfile

出力ファイルと tty の両方に同じ「こんにちは」を書き込みます。これにより、1 と 2 がリダイレクトされます。

あなたの説明から、スクリプトを試してください:

Linux / Unix Command: script

 Command Library
NAME

script - make typescript of terminal session  
SYNOPSIS

script [-a ] [-f ] [-q ] [-t ] [file ]  
DESCRIPTION

Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).
If the argument file is given, script saves all dialogue in file If no file name is given, the typescript is saved in the file typescript
于 2013-03-12T02:55:29.603 に答える
0

私は1000のコマ​​ンドを持っています

apt-get install;
mc;
apt-get update;
echo "foo";
..
..
..
nano /etc/passwd;
ls /tmp/log;
mc;
screen

結果を画面に送信し、ファイルに保存する必要があります。

何がコマンドを実行するかは誰にもわかりません。

ありがとうございました

于 2013-03-12T14:44:00.323 に答える