[Wylug-help] Sh problem
Towle, William
william.towle at echostar.com
Thu Apr 17 12:05:32 BST 2008
>= Anne, quoting Stephen:
> > so, write your backup script as
> > #!/bin/bash
> > cd /
> > export PWD
> > tar cvpzf /media/USB%20Flash%20Memory/partition1/EeePC(date
> +%F).tar.gz
> > --exclude=/media* --exclude=/proc/* --exclude=/lost+found/*
> > --exclude=/mnt/* --exclude=/sys/* --exclude=/home.* /
> >
> > then run the script itself through sudo.
> >
> > (may not need to export PWD)
>
> Hmm - that's got rid of some problems, but now it can't find
> the target:
>
> tar:
> /media/USB%20Flash%20Memory/partition1/EeePC2008-04-17.tar.gz: Cannot
> open: No such file or directory
The notation where '%20' means a space applies to WWW
URLs, not shell filenames; tar won't respect it and the
shell won't reinterpret it.
You've got two options here, depending which you think
is neatest. The quoting style is important in the first
case because of the way you want date's output used:
tar cvpzf "/media/USB Flash Memory/partition1/EeePC$(date
+%F).tar.gz" --exclude=/media* --exclude=/proc/* --exclude=/lost+found/*
--exclude=/mnt/* --exclude=/sys/* --exclude=/home.* /
tar cvpzf /media/USB' 'Flash' 'Memory/partition1/EeePC$(date
+%F).tar.gz --exclude=/media* --exclude=/proc/* --exclude=/lost+found/*
--exclude=/mnt/* --exclude=/sys/* --exclude=/home.* /
Wills.
More information about the Wylug-help
mailing list