dip

old school recipes for janitorial snafu.
git clone git://git.ricketyspace.net/dip.git
Log | Files | Refs

commit e242b62c2bb2bc4668ae2627298241740c8f7de8
parent cb78c9f1200094cafa026d3811ed37e636cbff0a
Author: rsiddharth <s@ricketyspace.net>
Date:   Tue,  8 Jan 2019 19:09:28 -0500

usr/local/bin/rsync-bu: bash -> sh.

Diffstat:
usr/local/bin/rsync-bu | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/usr/local/bin/rsync-bu b/usr/local/bin/rsync-bu @@ -1,4 +1,4 @@ -#!/usr/local/bin/bash +#!/usr/bin/env sh # # License: CC0-1.0 # @@ -10,11 +10,11 @@ parse_opts() { export BFILE=$1 - if [ -z $BFILE ]; then + if $(test -z $BFILE); then echo 'Backup info file not passed! Exiting.' exit 1 fi - if [ ! -f $BFILE ]; then + if ! $(test -f $BFILE); then echo $BFILE 'does not exist! Exiting.' exit 1 fi @@ -23,7 +23,7 @@ parse_opts() { parse_src() { echo 'checking source...' - if [ ! -d $1 ] && [ ! -f $1 ]; then + if ! $(test -d $1) && ! $(test -f $1 ); then echo 'Source "'$1'" does not exists' exit 1 fi @@ -33,10 +33,10 @@ parse_src() { parse_dest() { DIR=$(dirname $1) - if [ ! -d $DIR ]; then + if ! $(test -d $DIR); then echo 'Making '$DIR' ...' mkdir -p $DIR - [[ $? == 1 ]] && exit 1 + test $? = 1 && exit 1 fi return 0 @@ -46,8 +46,9 @@ bu() { # Make Options OPTS='-ravz --delete-excluded' - SRC=${1/#\~/$HOME} - DEST=${2/#\~/$HOME} + SRC=$(echo $1 | sed "s,~,$HOME,") + DEST=$(echo $2 | sed "s,~,$HOME,") + parse_src $SRC parse_dest $DEST