I am trying to pipe the output of a tail command into another bash script to process:
tail -n +1 -f your_log_file | myscript.sh
However, when I
Piping connects the output (stdout
) of one process to the input (stdin
) of another process. stdin
is not the same thing as the arguments sent to a process when it starts.
What you want to do is convert the lines in the output of your first process into arguments for the the second process. This is exactly what the xargs command is for.
All you need to do is pipe an xargs
in between the initial command and it will work:
tail -n +1 -f your_log_file | xargs | myscript.sh