我想使用 tee 命令将 bzip 命令的 stdop 重定向到日志文件,但它不起作用并且在 tee 命令中为“-a”给出错误。请查看下面的错误,
> bzip2 file -c 1> tee -a logfile
bzip2: Bad flag `-a'
bzip2, a block-sorting file compressor. Version 1.0.5, 10-Dec-2007.
usage: bzip2 [flags and input files in any order]
-h --help print this message
-d --decompress force decompression
-z --compress force compression
-k --keep keep (don't delete) input files
-f --force overwrite existing output files
-t --test test compressed file integrity
-c --stdout output to standard out
-q --quiet suppress noncritical error messages
-v --verbose be verbose (a 2nd -v gives more)
-L --license display software version & license
-V --version display software version & license
-s --small use less memory (at most 2500k)
-1 .. -9 set block size to 100k .. 900k
--fast alias for -1
--best alias for -9
If invoked as `bzip2', default action is to compress.
as `bunzip2', default action is to decompress.
as `bzcat', default action is to decompress to stdout.
If no file names are given, bzip2 compresses or decompresses
from standard input to standard output. You can combine
short flags, so `-v -4' means the same as -v4 or -4v, &c.
问题是什么?为什么 bzip 正在考虑 tee 命令的 '-a' 标志。
尝试:
bzip2 -c file | tee -a logfile
|
(管道)将左侧命令的标准输出重定向到右侧命令的标准输入。
-c
是 bzip2 的一个选项,表示 Compress or decompress to standard output.
。参见 man bzip2
我是一名优秀的程序员,十分优秀!