I want to read the current line of output from a bash command.
I know I could get this with cmd | tail -1
, but I want to run this as a seperate command (tint2 executable) as a sort of progress meter.
For example:
I have a python program that outputs Downloaded x out of y
as it downloads images, and I want to get the output as a shell variable.
Or:
Maybe I'm running pacman -Syy
and I want
extra 420.6 KiB 139K/s 00:09 [#####-----------------] 24%
Is this possible?
Edit: Something is running in the terminal. I want a command that outputs the last output of the command in the previous terminal, maybe inputting a pid.
var=$(cmd | tail -1)
– codeforesterpv
if you don't want to re-invent the wheel. – Benjamin W.