18 lines
		
	
	
		
			471 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			471 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| [ -f functions.sh ] && source functions.sh
 | |
| 
 | |
| for l in $3 ; do
 | |
| if [[ "${l}" =~ http://|https://|www\..* ]]; then
 | |
| pageTitle="$(wget --quiet -O - "$l" | sed -n -e 'H;${x;s!.*<head[^>]*>\(.*\)</head>.*!\1!;T;s!.*<title>\(.*\)</title>.*!\1!p}')"
 | |
| 
 | |
| # Fix up pageTitle a bit.
 | |
| pageTitle="${pageTitle//'/\'}"
 | |
| pageTitle="${pageTitle//–/-}"
 | |
| 
 | |
| shortLink="${l#*://}"
 | |
| shortLink="${shortLink%%/*}"
 | |
| if [ ${#pageTitle} -gt 1 ]; then
 | |
| msg "$2" "$pageTitle at $shortLink"
 | |
| fi
 | |
| fi
 | |
| done
 |