#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/url yewtube () { local url=$1 local youtube='https://www.youtube.com/watch?v=' local sub_str="${url##*youtube*}" if [ $sub_str ]; then echo $url else local last=${url//$youtube/} echo "$url - http://yewtu.be/$last" fi } url-exists () { local url=$1 echo ${${${(z)${"${(f)$(curl -s -I $url)}"[1]}}[2,-1]}%%$'\r'} }