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 3ed1dcc4f205a8ca8cd5605500aeb7147f00d832
parent 6e33c24ea5ae658a145e734f1fa6d1d3c2f8dc4d
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Sun, 23 Dec 2018 19:45:34 +0100

Change few characters for style

Diffstat:
Mlinks/bin/tpb | 18++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/links/bin/tpb b/links/bin/tpb @@ -1,9 +1,11 @@ -#!/bin/sh +#!/usr/bin/env bash # # by Sairon Istyar, 2012 # distributed under the GPLv3 license # http://www.opensource.org/licenses/gpl-3.0.html # +set -v +set -e ### CONFIGURATION ### # program to use for torrent download @@ -75,10 +77,10 @@ while getopts :hn:CP:: opt ; do esac done -shift `expr $OPTIND - 1` +shift $(expr $OPTIND - 1) # correctly encode query -q=`echo "$*" | tr -d '\n' | od -t x1 -A n | tr ' ' '%'` +q=$(echo "$*" | tr -d '\n' | od -t x1 -A n | tr ' ' '%') # if not searching, show top torrents if [ -z "$q" ] ; then @@ -100,7 +102,7 @@ r=`torify curl -k -A Mozilla -b "lw=s" -m 15 -s "$TPB/$url" \ | sed 'N;N;N;N;s!\n!|!g'` # number of results -n=`echo "$r" | wc -l` +n=$(echo "$r" | wc -l) IFS=$'\n' @@ -121,13 +123,13 @@ echo "$r" \ read -p ">> Torrents to download (eg. 1 3 5-7): " selection IFS=$'\n\ ' for num in $selection ; do - if [ "$num" = "`echo $num | grep -o '[[:digit:]][[:digit:]]*'`" ] ; then + if [ "$num" = "$(echo $num | grep -o '[[:digit:]][[:digit:]]*')" ] ; then down="$down $num" - elif [ "$num" = "`echo $num | grep -o '[[:digit:]][[:digit:]]*-[[:digit:]][[:digit:]]*'`" ] ; then + elif [ "$num" = "$(echo $num | grep -o '[[:digit:]][[:digit:]]*-[[:digit:]][[:digit:]]*')" ] ; then seqstart="${num%-*}" seqend="${num#*-}" if [ $seqstart -le $seqend ] ; then - down="$down `seq $seqstart $seqend`" + down="$down $(seq $seqstart $seqend)" fi fi done @@ -150,7 +152,7 @@ if ! [ "$(pidof $daemon)" ]; then if [ $torrent -ge 1 ] ; then if [ $torrent -le $limit ] ; then echo -n "$torrent " - command="$program `echo "$r" | awk -F '|' 'NR=='$torrent'{print $2; exit}'`" + command="$program $(echo "$r" | awk -F '|' 'NR=='$torrent'{print $2; exit}')" status=$(eval "$command" 2>&1) if [ $? -ne 0 ] ; then echo -n '(failed!) '