TIL: tar has --transform
Posted on October 15, 2016
I often have more than one version of a particular utility installed, and switch between them as needed. Out of habit, I will often append the version to the executable. For example, terraform-0.8.0-RC1
instead of terraform
.
TIL, tar
has --transform
to do this for you, and to save you from overwriting an existing symlink or other file. In practice, it looks like:
ᐅ tar -xf foobar.tar.gz -zvp \
... \
--transform=s,my_util,my_util-0.1.2, \
my_util