#!/bin/bash set -x # get format - I take the first one in the list that does not have audio or video only... frm=$(youtube-dl -F 'https://www.youtube.com/watch?v=SLWJuKQD030' | grep -v only | head -n4 | tail -n1 | awk -e '{print $1}') /usr/local/bin/youtube-dl --newline -f $frm "${1}" 2>&1 | /usr/bin/stdbuf -i0 -o0 -e0 cut -c 11-14 | while read x do /usr/bin/stdbuf -i0 -o0 -e0 printf "%3d%% .................................................................................................... \r\n" ${x} done