how to store result of tail command in variable? how to store result of tail command in variable? shell shell

how to store result of tail command in variable?


Since tail -f doesn't terminate, you don't want to capture its output in a variable. But since you call it in a loop anyway, call it over and over like this:

OUT=`tail "$path"`

Or using the modern syntax:

OUT=$(tail "$path")