In a bash script, I’m waiting on a child process’s pid using wait. That child process is writing to a log file. Is there a way in the bash script to tail that log file to std out while at the same time waiting on the process to complete?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the
tailcommand to follow the file while you wait for the command to finish.This is in spirit similar to William’s solution, but with one important difference: it will correctly print the log file if it takes longer for
commandto finish than it does forcatto print the file (quite likely, ascatis very fast). The-n +0option tellstailto print the whole file before it starts following updates.