From 3425b39cda52638ffa4940622d311b4a77e543ec Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 10 Jan 2017 11:22:26 +1300 Subject: Add safety left paren for subshell case --- bin/xgo | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/xgo b/bin/xgo index 46d90f2e..652d5a14 100755 --- a/bin/xgo +++ b/bin/xgo @@ -13,12 +13,12 @@ for url ; do ( case $url in # If this is a GitHub or GitLab link, swap "blob" for "raw" to get the actual file - *://github.com/*/blob/*|*://gitlab.com/*/blob/*) + (*://github.com/*/blob/*|*://gitlab.com/*/blob/*) url=$(printf '%s\n' "$url" | sed 's_/blob/_/raw/_') ;; # Dig out the plain text for pastebin.com links - *://pastebin.com/*) + (*://pastebin.com/*) # shellcheck disable=SC2016 url=$(printf '%s\n' "$url" | sed 's_/[A-Za-z0-9][A-Za-z0-9]*$_/raw&_') ;; @@ -26,14 +26,14 @@ for url ; do ( # If this is a not-direct imgur link and not to an album, swap URL # elements to get to the actual file (it may not actually be a JPEG; # the MIME type will tell us) - *://imgur.com/a/*) ;; - *://imgur.com/*) + (*://imgur.com/a/*) ;; + (*://imgur.com/*) url=$(printf '%s\n' "$url" | sed 's_imgur\.com_i.imgur.com_;s/$/.jpg/') ;; # If this is a YouTube video without a given start time, load it in mpv(1) - *[/.]youtube.com/watch*[?\&]t=) ;; - *[/.]youtube.com/watch*) + (*[/.]youtube.com/watch*[?\&]t=) ;; + (*[/.]youtube.com/watch*) mpv -- "$url" && exit ;; esac @@ -46,7 +46,7 @@ for url ; do ( # Open PDFs in xpdf(1); download them first as xpdf(1) does not seem to # have a way to handle stdin files - application/pdf) + (application/pdf) ( cd -- "$HOME"/Downloads || exit curl -O -- "$url" || exit @@ -56,18 +56,18 @@ for url ; do ( # Open audio and video in mpv(1); force a window even for audio so I # can control it - audio/*|video/*) + (audio/*|video/*) mpv --force-window -- "$url" && exit ;; # If the MIME type is an image that is not a GIF, load it in feh(1) - image/gif) ;; - image/*) + (image/gif) ;; + (image/*) curl -- "$url" | feh - && exit ;; # Open plain text in a terminal view(1) - text/plain) + (text/plain) # shellcheck disable=SC2016 urxvt -e sh -c 'curl -- "$1" | view -' _ "$url" && exit ;; -- cgit v1.2.3