From 74a58bdf05d19fd9820fda4e96a8e77602f74074 Mon Sep 17 00:00:00 2001 From: Ruben J Garcia Date: Thu, 18 Sep 2014 10:51:35 +0200 Subject: [PATCH] Error copying jobs Jobs with space in its name throws an error when trying to copy --- jenkins-backup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jenkins-backup.sh b/jenkins-backup.sh index 92f3467..7eb87d1 100755 --- a/jenkins-backup.sh +++ b/jenkins-backup.sh @@ -33,13 +33,13 @@ echo "cp $JENKINS_HOME/plugins/*.jpi $ARC_DIR/plugins" cp $JENKINS_HOME/plugins/*.jpi $ARC_DIR/plugins cd $JENKINS_HOME/jobs/ -for job_name in `ls -d *` +ls -1 | while read job_name do echo "mkdir -p $ARC_DIR/jobs/$job_name/" - mkdir -p $ARC_DIR/jobs/$job_name/ + mkdir -p $ARC_DIR/jobs/"$job_name"/ echo "cp $JENKINS_HOME/jobs/$job_name/*.xml $ARC_DIR/jobs/$job_name/" - cp $JENKINS_HOME/jobs/$job_name/*.xml $ARC_DIR/jobs/$job_name/ + cp $JENKINS_HOME/jobs/"$job_name"/*.xml $ARC_DIR/jobs/"$job_name"/ done cd $TMP_DIR