Hello Schmerold,
Hmm. The first question is a little puzzling but appears to be caused
by a mix up in the order of arguments. Try something like:
tar czf $bakname --exclude 'bu?.*' /home/* /etc/*
which should do the job for you. Note that when using the "f"
parameter, the filename for that tar archive should immediately follow
the "f". That is how you got the file named --exclude. You also should
quote the parameter for --exclude to prevent name expansion by the
shell. The rest is pretty standard. I did a quick check of the above
solution in a directory with five files in it:
a b --exclude bu1.x and bu2.x
and got a compressed tar archive with only
a b --exclude
in it (which appears to be what you wanted).
The solution to the second problem is pretty straight forward, but
somewhat difficult to find. The solution may vary based on what Unix
(or Linux) system you are using.
Try:
rm -- --exclude
or
rm ./--exclude
It may also be possible to use
rm - --exclude
on some systems as well.
Either of the first two should work, try the third if the first does not.
To quote from
info rm
(fileutils.info.gz) rm invocation
One common question is how to remove files whose names begin with a -.
GNU 'rm', like every program that uses the 'getopt' function to parse
its arguments, lets you use the '--' option to indicate that all
following options are non-options. To remove a file called '-f' in the
current directory, you could type either:
rm -- -f
or:
rm ./-f
The Unix 'rm' program's use of a single '-' for this purpose predates
the development of the getopt standard syntax.
A good search phrase to find other good examples would be to use
remove file "starting with"
which brings up several other alternative methods. The first link at
http://www.ittepic.edu.mx/eBooks/computacion/80oreilly/books/unix2/upt/ch23_15.htm
suggests using
rm -i *
which gives you the option to delete (or not) each file.
--Maniac |