This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:pipe [2019/06/05 11:43] – [Pipe to a file] tmade | linux:pipe [2022/02/16 04:34] (current) – [Pipe to a programm] tmade | ||
---|---|---|---|
Line 18: | Line 18: | ||
ls /opt/ /otherfile > file 2>& | ls /opt/ /otherfile > file 2>& | ||
+ | sudo -lU ${USER} > /dev/null 2>& | ||
+ | ls /opt /otherfile 2> / | ||
programm &> file # | programm &> file # | ||
echo "This is a test" 1> / | echo "This is a test" 1> / | ||
Line 32: | 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 | ||
Line 50: | Line 53: | ||
</ | </ | ||
innobackupex --apply-log $TARGET_FOLDER && /bin/echo " | innobackupex --apply-log $TARGET_FOLDER && /bin/echo " | ||
- | | ||
- | cp -a $(ls / | ||
| | ||
==== Pipe to a programm ==== | ==== Pipe to a programm ==== | ||
- | Output | + | Output |
| | ||
cat /etc/passwd | cut -d: -f1 | cat /etc/passwd | cut -d: -f1 |