在Linux系統中:
0 表示標準輸入;
1表示標準輸出;
2表示標準錯誤輸出;
2>&1 表示將標準錯誤輸出重定向到標準輸入;
舉一個例子:
a、不將標準錯誤輸出 重定向到標準輸入中。
[root@PC1 gffread-0.12.7.Linux_x86_64]# xxx ## 在終端隨機輸入一個命令,是一個錯誤輸出 bash: xxx: command not found... [root@PC1 gffread-0.12.7.Linux_x86_64]# xxx | head -n 0 ## 結合管道,表明左側的命令沒有進入管道,也就是說標準錯誤輸出直接輸出到終端了。 bash: xxx: command not found...
b、將標準錯誤輸出重定向到標準輸入中。
[root@PC1 gffread-0.12.7.Linux_x86_64]# xxx bash: xxx: command not found... [root@PC1 gffread-0.12.7.Linux_x86_64]# xxx | head -n 0 bash: xxx: command not found... [root@PC1 gffread-0.12.7.Linux_x86_64]# xxx 2>& 1 | head -n 0 ## 將標準錯誤輸出重定向到標準輸入中
。
舉例2:
a、
[root@PC1 gffread-0.12.7.Linux_x86_64]# ./gffread | head ## 管道不起作用 gffread v0.12.7. Usage: gffread [-g <genomic_seqs_fasta> | <dir>] [-s <seq_info.fsize>] [-o <outfile>] [-t <trackname>] [-r [<strand>]<chr>:<start>-<end> [-R]] [--jmatch <chr>:<start>-<end>] [--no-pseudo] [-CTVNJMKQAFPGUBHZWTOLE] [-w <exons.fa>] [-x <cds.fa>] [-y <tr_cds.fa>] [-j ][--ids <IDs.lst> | --nids <IDs.lst>] [--attrs <attr-list>] [-i <maxintron>] [--stream] [--bed | --gtf | --tlf] [--table <attrlist>] [--sort-by <ref.lst>] [<input_gff>] Filter, convert or cluster GFF/GTF/BED records, extract the sequence of transcripts (exon or CDS) and more. By default (i.e. without -O) only transcripts are processed, discarding any other non-transcript features. Default output is a simplified GFF3 with only the basic attributes. Options: --ids discard records/transcripts if their IDs are not listed in <IDs.lst> --nids discard records/transcripts if their IDs are listed in <IDs.lst> -i discard transcripts having an intron larger than <maxintron> -l discard transcripts shorter than <minlen> bases -r only show transcripts overlapping coordinate range <start>..<end> (on chromosome/contig <chr>, strand <strand> if provided) -R for -r option, discard all transcripts that are not fully contained within the given range
b、管道生效
[root@PC1 gffread-0.12.7.Linux_x86_64]# ls gffread LICENSE README.md x [root@PC1 gffread-0.12.7.Linux_x86_64]# ./gffread 2>& 1 | head -n 5 ## 管道生效,僅僅輸出5行 gffread v0.12.7. Usage: gffread [-g <genomic_seqs_fasta> | <dir>] [-s <seq_info.fsize>] [-o <outfile>] [-t <trackname>] [-r [<strand>]<chr>:<start>-<end> [-R]] [--jmatch <chr>:<start>-<end>] [--no-pseudo] [-CTVNJMKQAFPGUBHZWTOLE] [-w <exons.fa>] [-x <cds.fa>] [-y <tr_cds.fa>]
。