From: hackbard Date: Sun, 8 May 2016 09:21:40 +0000 (+0200) Subject: added -s to cut command X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9aa84203232e12dff1a14edcd0f9ed46a715289;p=outofuni%2Fbackup.git added -s to cut command --- diff --git a/bin/backup b/bin/backup index b29d2b7..9c63658 100755 --- a/bin/backup +++ b/bin/backup @@ -17,21 +17,21 @@ fi config=$1 -host=`grep ^host $config | cut -d ' ' -f 2` -aliases="`grep ^aliases $config | cut -d ' ' -f 2-`" -user=`grep ^user $config | cut -d ' ' -f 2` -homedirs="` grep ^homedirs $config | cut -d ' ' -f 2-`" -extradirs="`grep ^extradirs $config | cut -d ' ' -f 2-`" -replicas=`grep ^replicas $config | cut -d ' ' -f 2` -oldest=`grep ^oldest $config | cut -d ' ' -f 2` -data=`grep ^data $config | cut -d ' ' -f 2` -bandwidth=`grep ^bandwidth $config | cut -d ' ' -f 2` -bwconn="`grep ^bandwidth $config | cut -d ' ' -f 3-`" -compression=`grep ^compression $config | cut -d ' ' -f 2` -compconn="`grep ^compression $config | cut -d ' ' -f 3-`" -cipher=`grep ^cipher $config | cut -d ' ' -f 2` -ciconn=`grep ^cipher $config | cut -d ' ' -f 3-` -logdir=`grep ^logdir $config | cut -d ' ' -f 2` +host=`grep ^host $config | cut -s -d ' ' -f 2` +aliases="`grep ^aliases $config | cut -s -d ' ' -f 2-`" +user=`grep ^user $config | cut -s -d ' ' -f 2` +homedirs="` grep ^homedirs $config | cut -s -d ' ' -f 2-`" +extradirs="`grep ^extradirs $config | cut -s -d ' ' -f 2-`" +replicas=`grep ^replicas $config | cut -s -d ' ' -f 2` +oldest=`grep ^oldest $config | cut -s -d ' ' -f 2` +data=`grep ^data $config | cut -s -d ' ' -f 2` +bandwidth=`grep ^bandwidth $config | cut -s -d ' ' -f 2` +bwconn="`grep ^bandwidth $config | cut -s -d ' ' -f 3-`" +compression=`grep ^compression $config | cut -s -d ' ' -f 2` +compconn="`grep ^compression $config | cut -s -d ' ' -f 3-`" +cipher=`grep ^cipher $config | cut -s -d ' ' -f 2` +ciconn=`grep ^cipher $config | cut -s -d ' ' -f 3-` +logdir=`grep ^logdir $config | cut -s -d ' ' -f 2` dolog=0 if [ ! -z "$logdir" ]; then @@ -64,9 +64,9 @@ comp=6 if [ ! -z "$compression" ]; then comp=$compression for cpair in "$compconn"; do - ch=`echo $cpair | cut -d ':' -f 1` + ch=`echo $cpair | cut -s -d ':' -f 1` if [[ "$remote" == "$ch"* ]]; then - cl=`echo $cpair | cut -d ':' -f 2` + cl=`echo $cpair | cut -s -d ':' -f 2` [[ "$cl" == [0-9] ]] && comp=$cl fi done @@ -78,9 +78,9 @@ bw=0 if [ ! -z "$bandwidth" ]; then bw=$bandwidth for bwpair in "$bwconn"; do - ch=`echo $bwpair | cut -d ':' -f 1` + ch=`echo $bwpair | cut -s -d ':' -f 1` if [[ "$remote" == "$ch"* ]]; then - bwl=`echo $cpair | cut -d ':' -f 2` + bwl=`echo $cpair | cut -s -d ':' -f 2` [ ! -z "$bwl" ] && bw=$bwl fi done @@ -92,9 +92,9 @@ ciph="" if [ ! -z "$cipher" ]; then ciph=$cipher for cipair in "$ciconn"; do - ch=`echo $cipair | cut -d ':' -f 1` + ch=`echo $cipair | cut -s -d ':' -f 1` if [[ "$remote" == "$ch"* ]]; then - cl=`echo $cipair | cut -d ':' -f 2` + cl=`echo $cipair | cut -s -d ':' -f 2` [ ! -z "$cl" ] && ciph=$cl fi done @@ -183,7 +183,7 @@ fi cob=`echo $ob | wc -w` if [ $cob -gt $replicas ]; then ((numdel=cob-replicas)) - todel="`echo $ob | cut -d ' ' -f 1-${numdel}`" + todel="`echo $ob | cut -s -d ' ' -f 1-${numdel}`" for dirdel in $todel; do past=`basename $dirdel` ns=`date --date="$today" +%s`