dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 465003ab882a59f49986a7c97ec06bb9ca2c57e0
parent becab61b6a1a292075699c03846ae98b49875ed8
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue,  4 Jun 2019 16:16:49 +0200

Make linkhandler POSIX sh compatible and remove newline from copied url

Diffstat:
M.local/bin/linkhandler | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh for url in "$@"; do case "$url" in @@ -10,14 +10,14 @@ for url in "$@"; do if [ -f "$url" ]; then "$TERMINAL" -e "$EDITOR $url" else - url="$(echo "$url" | sed 's|http.*://scholar\.google\..*url=||;s|&rt=.*$||')" + url="$(printf "%s" "$url" | sed 's|http.*://scholar\.google\..*url=||;s|&rt=.*$||')" action="$(printf "Open\nOpen (Tor Browser)\nCopy\nDownload\nSci-Hub\nAdd reference\nPlay" | dmenu_themed -i -p "Action:")" if [ "$action" = "Open" ]; then setsid xdg-open "$url" >/dev/null 2>&1 & elif [ "$action" = "Open (Tor Browser)" ]; then setsid tor-browser "$url" >/dev/null 2>&1 & elif [ "$action" = "Copy" ]; then - echo "$url" | xclip + printf "%s" "$url" | xclip elif [ "$action" = "Download" ]; then mkdir -p ~/tmp/ cd ~/tmp/ || exit