Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have written a backup script to allow for backups from across a windows network and am having trouble with backing up directories that have spaces as their name i.e backup test. It works if the share name is backup_test. I know that linux doesn't like spaces and can use \ to specify a space but that is not working. Does anyone have any suggestions?
This doesn't seem to be working. Would I have to put:
BACKUP_SHARE="backup test"
or
"BACKUP_SHARE=backup test"
I tried the first one and that doesn't work for me. Any other ideas other than having everyone change the directories? Some of this directories are shares that involve microsoft paths i.e c:\program files ... etc
#!/bin/bash
#this is the administrator account on the windows machines
USERNAME1=administrator
PASSWORD1=administrator_password
#
DRIVE=/root/backup
#
TARGET_MACHINE=laptop
BACKUP_SHARE=backup test ***this is where the trouble lies***
#
mkdir $DRIVE/$TARGET_MACHINE
cd $DRIVE/$TARGET_MACHINE
#
smbclient //$TARGET_MACHINE/$BACKUP_SHARE $PASSWORD1 -U $USERNAME1 -c "recurse;prompt;mget *;"
#
tar cvpz $DRIVE/$TARGET_MACHINE > $DRIVE/$TARGET_MACHINE.tar.gz
rm -rf $DRIVE/$TARGET_MACHINE
#
This doesn't seem to be working. Would I have to put:
BACKUP_SHARE="backup test"
or
"BACKUP_SHARE=backup test"
it was the upper one of those I thought...but if it won't work, then I have no clue :/ sorry..I don't do this kind of scripting that much myself..but I think someone has asked a thing like this earlier...I'm not sure if it was just like this, but had something to do with spaces in scripting...damn, if only I could remember what thread it was..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.