[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Redirecionamentos específicos
From: |
MrBiTs |
Subject: |
Re: [shell-script] Redirecionamentos específicos |
Date: |
Tue, 23 Aug 2005 07:13:32 -0300 |
/*
Quem desejar direcionar a saida do time para algum arquivo pode utilizar :
/usr/bin/time -po "/tmp/saida.txt" ls
Detalhe é necessário o caminho do executavel (pelo menos no bash que eu testei).
*/
Você tem que informar o caminho completo do arquivo pois Bash define uma função
interna chamada time, que faz exatamente a mesma coisa que a ferramenta
/usr/bin/time ( constante de um pacote chamado time ). Entretanto, a função
time não possui o parametro -o, e temos o erro de Comando Não Encontrado.
Vejamos, da função help do bash:
# help
GNU bash, version 2.05b.0(1)-release (i686-pc-linux-gnu)
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
........
time [-p] PIPELINE times
........
E do
# help time
time: time [-p] PIPELINE
Execute PIPELINE and print a summary of the real time, user CPU time,
and system CPU time spent executing PIPELINE when it terminates.
The return status is the return status of PIPELINE. The `-p' option
prints the timing summary in a slightly different format. This uses
the value of the TIMEFORMAT variable as the output format.
E depois, da ferramenta /usr/bin/time:
# /usr/bin/time --help
Usage: /usr/bin/time [-apvV] [-f format] [-o file] [--append] [--verbose]
[--portability] [--format=format] [--output=file] [--version]
[--help] command [arg...]
No seu segundo formato de comando $(time ls) >&, você não está utilizando a
ferramenta time, mas sim a função interna do bash time.
[As partes desta mensagem que não continham texto foram removidas]
- Re: [shell-script] Redirecionamentos específicos,
MrBiTs <=