function youtube-dl {
exe=$HOME/bin/youtube-dl link=https://rg3.github.io/youtube-dl/download.html url=$(curl -s $link |grep ">sig<" |head -1|sed -e 's/href="/|/g' -e 's/">/|/g'|cut -d"|" -f2) fetch=N if [ -s "$exe" ] ; then ts=$(date "+%s") yts=$(stat -c "%Y" $exe) [ $(( ($ts-$yts)/(60*60) )) -gt 24 ] && fetch=Y else fetch=Y fi if [ "$fetch" = "Y" ] ; then url=$(curl -s $url |grep ">sig<" |head -1|sed -e 's/href="/|/g' -e 's/">/|/g'|cut -d"|" -f2) echo "Fetching [$url] and deploying to [$exe]" curl -s $url -o $exe chmod a+x $exe fi [ -z "$@" ] && $exe --help || $exe $@ }
function youtube-dl {