[kwlug-disc] tar question regarding leading "/"

Chris Frey cdfrey at foursquare.net
Tue Oct 3 15:33:22 EDT 2023


On Tue, Oct 03, 2023 at 12:08:56PM -0700, Ronald Barnes wrote:
> If I run it with a leading "/" on the systemd file, this is the output:
> 
> # tar -v  --directory=/ -pjcf /tmp/mailman-test.tar
> /lib/systemd/system/mailman*  etc/apache2/sites-available/mailman2.conf
> tar: Removing leading `/' from member names
> /lib/systemd/system/mailman.service
> tar: Removing leading `/' from hard link targets
> etc/apache2/sites-available/mailman2.conf

So the question is *when* the wildcard is expended.

In both examples, tar only changes the current working directory once
it runs.  Bash is still running in the directory you are in.

So the first example tries to find systemd files relative to bash.
The second example does an absolute search.

- Chris




More information about the kwlug-disc mailing list