From c0ff56729a59dc30589de6af6120d825fbaa8cc3 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 27 Nov 2016 23:51:59 +1000 Subject: Break out common script bits into their own file. --- scripts/backup-sims.sh | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'scripts/backup-sims.sh') diff --git a/scripts/backup-sims.sh b/scripts/backup-sims.sh index fb18c18..2d174b1 100755 --- a/scripts/backup-sims.sh +++ b/scripts/backup-sims.sh @@ -1,25 +1,12 @@ #!/bin/bash -# Figure out where we are, most of this mess is to troll through soft links. -PRG="$0" -while [ -h "${PRG}" ] ; do - ls=$(ls -ld "${PRG}") - link=`expr "${ls}" : '.*-> \(.*\)$'` - if expr "${link}" : '.*/.*' > /dev/null; then - PRG="${link}" - else - PRG=$(dirname "${PRG}")/"${link}" - fi -done -PRGDIR=$(dirname "${PRG}") -pushd ${PRGDIR} >/dev/null -PRGDIR=$(pwd) -popd >/dev/null +source common.sh +getPrgDir for i in $(seq 99) do - j=$(printf "sim%02d" $i) - if [ -e "${PRGDIR}/../config/$j" ] + j=$(num2name ${i}) + if [ -e "${PRGDIR}/../config/${j}" ] then cd ${PRGDIR}/../config/$j ./backup-sim -- cgit v1.1