diff options
author | Jesse Luehrs <doy@tozt.net> | 2018-11-10 17:36:48 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2018-11-10 17:36:48 -0500 |
commit | e0b49dc051695db9df3f93de20f0f3469e79f7cc (patch) | |
tree | 6e234e58e773240fbb6ee7897acb5e339c57ac91 /bin | |
parent | 740df724f2b41fb6873c02d4282ffebbe7831427 (diff) | |
download | conf-e0b49dc051695db9df3f93de20f0f3469e79f7cc.tar.gz conf-e0b49dc051695db9df3f93de20f0f3469e79f7cc.zip |
simplify
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/hush/update-weather | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/bin/hush/update-weather b/bin/hush/update-weather index 189929e..8105223 100755 --- a/bin/hush/update-weather +++ b/bin/hush/update-weather @@ -1,19 +1,6 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use 5.020; -use feature 'signatures'; -no warnings 'experimental::signatures'; +#!/bin/sh +set -eu +set -o pipefail -use open ':encoding(UTF-8)', ':std'; - -if (my $weather = `weather`) { - spew("$ENV{HOME}/.cache/weather", $weather); -} - -sub spew($filename, $contents) { - open my $fh, '>', $filename - or die "couldn't open $filename: $!"; - print $fh $contents; - close $fh; -} +weather > ~/.cache/weather.new +mv ~/.cache/weather.new ~/.cache/weather |