21 lines
		
	
	
		
			934 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			934 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
#! /usr/bin/env sh
 | 
						|
 | 
						|
# Description:            Get a quot from http://danstonchat.com
 | 
						|
 | 
						|
if [ $(command -v lynx) ]; then
 | 
						|
	lynx --dump --display_charset=utf8 http://danstonchat.com/random0.html | awk '$0~"Ajouter une quote.*Betamod" && $0!~"Score" { getline; while ($0!~"Score") { print $0; getline;}; exit }'
 | 
						|
else
 | 
						|
  printf '%b' "Please install lynx package.\n"
 | 
						|
fi
 | 
						|
 | 
						|
#awk                              : chope les lignes où…
 | 
						|
#$0~"Ajouter une quote.*Betamod"  : apparaît ce motif
 | 
						|
#&&                               :                        ET
 | 
						|
#$0!~"Sco"                        : la ligne entière ($0) ne contient pas Score
 | 
						|
#{                                : fait…
 | 
						|
#getline;                         : chope la ligne suivante
 | 
						|
#while ($0!~"Score")              : tant que la ligne ne contient pas Score
 | 
						|
#{ print $0; getline;};           : affiche la ligne entière
 | 
						|
#exit                             : quitte (on veut une seule quote)
 | 
						|
#}
 |