l 5 acronym: refactor code

This commit is contained in:
lassulus 2016-04-13 16:48:32 +02:00
parent 9717e5a2e0
commit 2e87439340

View File

@ -1,13 +1,16 @@
{ pkgs, ... }: { pkgs, ... }:
pkgs.writeScriptBin "acronym" '' pkgs.writeScriptBin "acronym" ''
#! ${pkgs.bash}/bin/bash #! ${pkgs.bash}/bin/bash
acro=$1 acro=$1
curl -s http://www.acronymfinder.com/$acro.html \ curl -s http://www.acronymfinder.com/$acro.html \
| grep 'class="result-list__body__rank"' \ | grep 'class="result-list__body__rank"' \
| sed 's/.*title="\([^"]*\)".*/\1/' \ | sed '
| sed 's/^.* - //' \ s/.*title="\([^"]*\)".*/\1/
| sed "s/'/'/g" s/^.* - //
s/'/'\'''/g
'
'' ''