I try using
tar to backup my files. With
--exclude=/proc/, the archive contains files under /proc, and
--exclude=/proc does not. What causes the difference?
P.S. The shell I use is Bash.
There is really no major difference between using a trailing slash or not in general for a directory, except in symlink handling. See Open Group Base Specifications, 4.11 Pathname Resolution (also see this answer at Unix SE).
As GNU tar is concerned: a trailing slash is simply not handled in
Usually, it's down to the convention of the program. With (GNU)
Documentation isn't clear that there is a difference, or why.
Internally, the reason a trailing / doesn't match in an exclude is that
A related issue is that sometimes you want to backup a directory because it's a mount point, though you don't want its contents. The intent being your backup can contain all the required mount points (