bash_quote: correct shebang and check if lynx is available.

This commit is contained in:
Jeremy Gardais 2015-09-08 02:14:15 +02:00
parent eaa960ae4e
commit 18224ba566
1 changed files with 6 additions and 2 deletions

View File

@ -1,8 +1,12 @@
#! /bin/sh
#! /usr/bin/env sh
# Description: Get a quot from http://danstonchat.com
lynx --dump --display_charset=utf8 http://danstonchat.com/random.html | awk '$4~"commentaires" && $0!~"RSS" { getline; while ($4!~"#") { print $0; getline;}; exit}'
if [ $(command -v lynx) ]; then
lynx --dump --display_charset=utf8 http://danstonchat.com/random.html | awk '$4~"commentaires" && $0!~"RSS" { getline; while ($4!~"#") { print $0; getline;}; exit}'
else
printf '%b' "Please install lynx package.\n"
fi
#awk : chope les lignes où…
#$1~"#" : le premier terme ($1) contient un dièse