This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
linux:pipe [2019/06/05 11:40] – [Pipe to a file] tmade | linux:pipe [2022/02/16 04:30] – [Error-handling] tmade | ||
---|---|---|---|
Line 18: | Line 18: | ||
ls /opt/ /otherfile > file 2>& | ls /opt/ /otherfile > file 2>& | ||
- | ls /opt/ / | + | |
+ | | ||
+ | | ||
echo "This is a test" 1> / | echo "This is a test" 1> / | ||
ls xyz > info.txt 2> error.txt | ls xyz > info.txt 2> error.txt | ||
Line 33: | Line 34: | ||
command1 && command2 | command1 && command2 | ||
command1 || command2 | command1 || command2 | ||
+ | command1 && command2 || command3 | ||
| | ||
==== Error-handling ==== | ==== Error-handling ==== | ||
To check if a process is running/ return code: | To check if a process is running/ return code: | ||
- | SERVICE_NAME=apache2 | + | |
- | + | ||
(ps -ef | grep $SERVICE_NAME | (ps -ef | grep $SERVICE_NAME | ||
ps -ef | grep $SERVICE_NAME | grep -v grep && RESULT=running || RESULT=error | ps -ef | grep $SERVICE_NAME | grep -v grep && RESULT=running || RESULT=error |