openurl.sh (445B)
1 #!/bin/sh 2 # openurl 3 # description: xdg-open all urls found in $@ 4 # e.g.$ openurl saved-links.txt 5 6 open=xdg-open 7 if [ "$(uname)" = "Darwin" ]; then open=open; fi 8 9 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then 10 echo "usage: ./openurl.sh FILEPATHS..." 11 echo "" 12 echo "open all links existing in contents of listed files" 13 exit 14 fi 15 16 for f in "$@"; do 17 while read -r url; do 18 $open "$url" | grep -q 'https?://(^")+' | tr -d '\r' 19 done < "$f" 20 done 21