redirection order + notes about command -v

pull/27/head
Igor Chubin 7 years ago committed by GitHub
parent 141573fcf0
commit 7f07bf05ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,9 +37,11 @@ echo ${PIPESTATUS[0]} # replace 0 with N
# for loop in one line
for i in $(seq 1 4); do echo $i; done
# Test if a program exists in the path
command -v <program> 2>&1 >/dev/null || error "<program> not installed"
# Test if a program exists in the path
# There are false positives: aliases and functions
command -v ${program} >/dev/null 2>&1 || error "${program} not installed"
# Redirection
my_command 2>&1 > command-stdout-stderr.txt
my_command 2>&1 > /dev/null
# Please note that 2>&1 goes after
my_command > command-stdout-stderr.txt 2>&1
my_command > /dev/null 2>&1

Loading…
Cancel
Save