Difference between revisions of "Standard input (/dev/stdin)"
Jump to navigation
Jump to search
m (Welcome moved page Standard input (stdin) to Standard input (/dev/stdin)) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 11: | Line 11: | ||
#!/bin/bash - | #!/bin/bash - | ||
− | exec > >(tee "$HOME/somefile.log") 2>&1 | + | exec > >([[tee]] "$HOME/somefile.log") [[2]]>[[&1]] |
echo "$HOME" | echo "$HOME" | ||
echo hi | echo hi | ||
− | + | echo "Command to err but will be redirected to stdout" 1>&2 | |
− | + | command_that_pipes_output_to_stderr_but_will_be_redirected_to_stdout | |
− | echo | + | echo "End script" |
== Activities == | == Activities == | ||
Line 26: | Line 26: | ||
* <code>[[tee]]</code> | * <code>[[tee]]</code> | ||
* <code>[[/dev/null]]</code> | * <code>[[/dev/null]]</code> | ||
− | * [[file descriptor]] | + | * <code>[[file descriptor]]</code> |
− | * [[logger]] | + | * <code>[[logger]]</code> |
− | * [[gcloud]] | + | * <code>[[gcloud]]</code> |
== See also == | == See also == |
Latest revision as of 11:37, 15 February 2024
This article is a Draft. Help us to complete it.
2>&1
&>
https://unix.stackexchange.com/questions/61931/redirect-all-subsequent-commands-stderr-using-exec #!/bin/bash - exec > >(tee "$HOME/somefile.log") 2>&1 echo "$HOME" echo hi echo "Command to err but will be redirected to stdout" 1>&2 command_that_pipes_output_to_stderr_but_will_be_redirected_to_stdout echo "End script"
Activities[edit]
- Compress data from
stdin
:echo "DATA TO COMPRESS" | xz --verbose > file.xz
docker logs 2>&1 | grep TEXT
Related terms[edit]
See also[edit]
echo
,print, printf
,tput
,logger
,write-output, echo -e, /dev/stdout, banner
- Standard streams:
/dev/stdin
,/dev/stdout
,/dev/stderr
,/dev/null
, File descriptor,set -x, 2>&1, stdbuf
Bash [ -c ]
,alias
,&&
, Bash history, Autocompletion,set
,unset
,export
,.bash_aliases, .bashrc and .bash profile
,PS1
,echo
,brace expansion
, Function,shopt
,trap
,set -e
,source
,PATH
,complete
,disown
,.hushlogin
,.bashrc
,builtin
,eval
,set
,$PATH
,$HOME
,TZ
,.profile
,-e, -i
,Builtin (Bash)
,mapfile
,~
, return (Bash), for, until,declare, dirname, basename, functions.sh
, Bash arithmetic expansion,shift, bash --rcfile, readonly, $1, $@
Advertising: