Register
It is currently Fri Apr 18, 2014 12:12 am

Space in path using rsync in bash script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Wed May 20, 2009 7:57 pm   

Joined: Wed May 20, 2009 7:52 pm
Posts: 1
I use a small script to backup my files to the flash disk. Some flash disks when mounted automatically have a space in the path (/media/USB DISK for example).

My script works when there is no space but fails when there is a space.

I read about symbolic links, and tried to create one in the bash script without success.

Here is my script which works with a KINGSTON flash disk...

(I transfer my python source code to/from the office on my flash disk each day using this script.)

echo '------------------------------'
echo ' 1. Send to flash disk'
echo ' 2. Update from flash disk'
echo '------------------------------'
echo -e 'Selection (1,2): \c'
read sel
if [ $sel = '1' ]; then
source='/home/xpData/programing/'
target='/media/KINGSTON/programing/'
else
source='/media/KINGSTON/programing/'
target='/home/xpData/programing/'
fi

echo $source
echo $target

rsync -nuvr --exclude-from=excluded_files $source $target

echo -e 'Continue (y/n): \c'
read ans

if [ $ans = 'y' ]; then
echo 'Updating'
rsync -tur --exclude-from=excluded_files $source $target
else
echo 'Cancelled'
fi


Top
 Profile  
 PostPosted: Thu May 21, 2009 10:11 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 512
use more quotes

command "$var"


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP