Link to home
Start Free TrialLog in
Avatar of wanted4u
wanted4u

asked on

'simple' script / tar archive problem

Hi,

I've the following problem:

When I want to restore multiple files with tar i use the following syntax:

tar -xvf /mnt/usbdrive/backup/vantriest-Fri.tar file1.jpg file2.doc file4.jpg

because of some files have some spaces in the filenames I set the files between comments

tar -xvf /mnt/usbdrive/backup/vantriest-Fri.tar 'file1.jpg' 'file2.doc' 'file4.jpg' 'long filename.jpg'

this works fine .. but not in a script!?!
When I do the exact same thing at the prompt it works fine...
What do i wrong?

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
the script
-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-
#!/bin/sh
cd /mnt/restore

tar -xvf /mnt/usbdrive/backup/deburg-Fri.tar 'mnt/deburg/deBurgMakelaars/deburgmakelaars website/offertedeburg.doc' 'mnt/deburg/deBurgMakelaars/deburgmakelaars website/Onderstaand de aanpassingen die nog uitgevoerd moeten worden.doc' 'mnt/deburg/deBurgMakelaars/deburgmakelaars website/deburg.ppt' 'mnt/deburg/deBurgMakelaars/deburgmakelaars website/zoekcriteria www.deburgmakelaars.nl.doc'

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Output
=-=-=-=-=-=-=-=-=-=-=-=
[root@backup backup]# /tmp/commands.sh
mnt/deburg/deBurgMakelaars/deBurgMakelaars website/offertedeburg.doc
tar: mnt/deburg/deBurgMakelaars/deBurgMakelaars website/offertedeburg.doc: Cannot open: No such file or directory
mnt/deburg/deBurgMakelaars/deBurgMakelaars website/Onderstaand de aanpassingen die nog uitgevoerd moeten worden.doc
tar: mnt/deburg/deBurgMakelaars/deBurgMakelaars website/Onderstaand de aanpassingen die nog uitgevoerd moeten worden.doc: Cannot open: No such file or directory
mnt/deburg/deBurgMakelaars/deBurgMakelaars website/deburg.ppt
tar: mnt/deburg/deBurgMakelaars/deBurgMakelaars website/deburg.ppt: Cannot open: No such file or directory
mnt/deburg/deBurgMakelaars/deBurgMakelaars website/zoekcriteria www.deburgMakelaars.nl.doc
tar: mnt/deburg/deBurgMakelaars/deBurgMakelaars website/zoekcriteria www.deBurgMakelaars.nl.doc: Cannot open: No such file or directory

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Thanks in advance,

V.R. Jansen
ASKER CERTIFIED SOLUTION
Avatar of Malohi
Malohi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ssvl
Hi Malohi,

use escape charaters of blank spaces

eg mnt/deburg/deBurgMakelaars/deBurgMakelaars website/offertedeburg.doc it is wrong path

actulay it is like  /mnt/deburg/deBurgMakelaars/deBurgMakelaars\ website/offertedeburg.doc  change this then only your scrit work


SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial