time
is a Bash command that displays information on the shell standard error.
#!/bin/bash
PS4='+ ${FUNCNAME[0]}: '
set -o xtrace
exec 3>&2
runtime() ( time -p "$@" 2>&3 ) 2>runtime.log
# or runtime() { time -p "$@" 2>&3; } 2>runtime.log
runtime find "/usr"
runtime
is a shell function executed in a subshell. The trick is to create a new file descriptor (fd3
) that refers to the shell standard error (fd 2
), then, override the subshell standard error (2>runtime.log
) and redirect the error stream of the command to the shell standard error using the new file descriptor (2>&3
).
prompt% cat runtime.log
+ ./test: line 9: (runtime): find /usr
real 64.82
user 1.62
sys 3.67
time
is a Bash command that displays information on the shell standard error.
#!/bin/bash
PS4='+ ${FUNCNAME[0]}: '
set -o xtrace
exec 3>&2
runtime() ( time -p "$@" 2>&3 ) 2>runtime.log
# or runtime() { time -p "$@" 2>&3; } 2>runtime.log
runtime find "/usr"
runtime
is a shell function executed in a subshell. The trick is to create a new file descriptor (fd3
) that refers to the shell standard error (fd 2
), then, override the subshell standard error (2>runtime.log
) and redirect the error stream of the command to the shell standard error using the new file descriptor (2>&3
).
prompt% cat runtime.log
+ ./test: line 9: (runtime): find /usr
real 64.82
user 1.62
sys 3.67
time
is a Bash command that displays information on the shell standard error.
#!/bin/bash
PS4='+ ${FUNCNAME[0]}: '
set -o xtrace
exec 3>&2
runtime() ( time -p "$@" 2>&3 ) 2>runtime.log
# or runtime() { time -p "$@" 2>&3; } 2>runtime.log
runtime find "/usr"
runtime
is a shell function executed in a subshell. The trick is to create a new file descriptor (fd3
) that refers to the shell standard error (fd 2
), then, override the subshell standard error (2>runtime.log
) and redirect the error stream of the command to the shell standard error using the new file descriptor (2>&3
).
prompt% cat runtime.log
+ runtime: find /usr
real 64.82
user 1.62
sys 3.67
time
is a Bash command that displays information on the shell standard error.
#!/bin/bash
PS4='+ ${BASH_SOURCE[1]}: line ${BASH_LINENO[0]}: (${FUNCNAME[0]}): '
set -o xtrace
exec 3>&2
runtime() ( time -p "$@" 2>&3 ) 2>runtime.log
# or runtime() { time -p "$@" 2>&3; } 2>runtime.log
runtime find "/usr"
runtime
is a shell function executed in a subshell. The trick is to create a new file descriptor (fd3
) that refers to the shell standard error (fd 2
), then, override the subshell standard error (2>runtime.log
) and redirect the error stream of the command to the shell standard error using the new file descriptor (2>&3
).
prompt% cat runtime.log
+ ./test: line 9: (runtime): find /usr
real 64.82
user 1.62
sys 3.67
time
is a Bash command that displays information on the shell standard error.
#!/bin/bash
PS4='+ ${BASH_SOURCE[1]}: line ${BASH_LINENO[0]}: (${FUNCNAME[0]}): '
set -o xtrace
exec 3>&2
runtime() ( time -p "$@" 2>&3 ) 2>runtime.log
# or runtime() { time -p "$@" 2>&3; } 2>runtime.log
runtime find "/usr"
runtime
is a shell function executed in a subshell. The trick is to create a new file descriptor (fd3
) that refers to the shell standard error (fd 2
), then, override the subshell standard error (2>runtime.log
) and redirect the error stream of the command to the shell standard error using the new file descriptor (2>&3
).
prompt% cat runtime.log
+ ./test: line 9: (runtime): find /usr
real 64.82
user 1.62
sys 3.67
time
is a Bash command that displays information on the shell standard error.
#!/bin/bash
PS4='+ ${FUNCNAME[0]}: '
set -o xtrace
exec 3>&2
runtime() ( time -p "$@" 2>&3 ) 2>runtime.log
# or runtime() { time -p "$@" 2>&3; } 2>runtime.log
runtime find "/usr"
runtime
is a shell function executed in a subshell. The trick is to create a new file descriptor (fd3
) that refers to the shell standard error (fd 2
), then, override the subshell standard error (2>runtime.log
) and redirect the error stream of the command to the shell standard error using the new file descriptor (2>&3
).
prompt% cat runtime.log
+ ./test: line 9: (runtime): find /usr
real 64.82
user 1.62
sys 3.67
time
is a Bash command that displays information on the shell standard error.
#!/bin/bash
PS4='+ ${BASH_SOURCEBASH_SOURCE[1]}: line ${LINENOBASH_LINENO[0]}: (${FUNCNAME[0]}): }'
set -o xtrace
exec 3>&2
runtime() ( time -p "$@" 2>&3 ) 2>runtime.log
# or runtime() { time -p "$@" 2>&3; } 2>runtime.log
runtime find "/usr"
runtime
is a shell function executed in a subshell. The trick is to create a new file descriptor (fd3
) that refers to the shell standard error (fd 2
), then, override the subshell standard error (2>runtime.log
) and redirect the error stream of the command to the shell standard error using the new file descriptor (2>&3
).
prompt% cat runtime.log
+ ./test: line 9: (runtime): find /usr
real 64.82
user 1.62
sys 3.67
time
is a Bash command that displays information on the shell standard error.
#!/bin/bash
PS4='+ ${BASH_SOURCE}: line ${LINENO}: (${FUNCNAME[0]}): }'
set -o xtrace
exec 3>&2
runtime() ( time -p "$@" 2>&3 ) 2>runtime.log
# or runtime() { time -p "$@" 2>&3; } 2>runtime.log
runtime find "/usr"
runtime
is a shell function executed in a subshell. The trick is to create a new file descriptor (fd3
) that refers to the shell standard error (fd 2
), then, override the subshell standard error (2>runtime.log
) and redirect the error stream of the command to the shell standard error using the new file descriptor (2>&3
).
prompt% cat runtime.log
+ ./test: line 9: (runtime): find /usr
real 64.82
user 1.62
sys 3.67
time
is a Bash command that displays information on the shell standard error.
#!/bin/bash
PS4='+ ${BASH_SOURCE[1]}: line ${BASH_LINENO[0]}: (${FUNCNAME[0]}): '
set -o xtrace
exec 3>&2
runtime() ( time -p "$@" 2>&3 ) 2>runtime.log
# or runtime() { time -p "$@" 2>&3; } 2>runtime.log
runtime find "/usr"
runtime
is a shell function executed in a subshell. The trick is to create a new file descriptor (fd3
) that refers to the shell standard error (fd 2
), then, override the subshell standard error (2>runtime.log
) and redirect the error stream of the command to the shell standard error using the new file descriptor (2>&3
).
prompt% cat runtime.log
+ ./test: line 9: (runtime): find /usr
real 64.82
user 1.62
sys 3.67