Consider the following command:
echo ’.dump’ | sqlite bacula.db > bacula.sq
What is it doing and what does | do?
Maybe someone could point me to a manual about piping, or explain what is going on. Thanks.
Consider the following command:
echo ’.dump’ | sqlite bacula.db > bacula.sq
What is it doing and what does | do?
Maybe someone could point me to a manual about piping, or explain what is going on. Thanks.
Shell pipe operator | makes standard output for a command the standard input for the next command, without creating an intermediate file.
You can find detailed information explained in a simple way in the following sources:
| is a pipeline operator in Unix/Linux. It could be used where the output of the first command can be used as input to the second command.
For example:
ls -l | less will show the longlist of your files in the directory. The less command takes the output of ls -l as input and displays the list of files where you scroll up/down and see them.
This command writes the string consisting of the seven characters ’.dump’ followed by a newline character to the sqlite command. (That's 12 bytes in all.)
The sqlite command will fail to understand the instruction and will so write nothing to the target file bacula.sq, reporting Error: incomplete SQL: ’.dump’ to stderr.
Perhaps you meant this instead, which uses single quote characters ' instead of apostrophe marks ’:
echo '.dump' | sqlite bacula.db > bacula.sq