This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/common/bin/unarchive

10 lines
253 B
Plaintext
Raw Normal View History

2019-12-05 16:09:52 -06:00
#!/usr/bin/env bash
archive_name="${1}"; shift
2020-04-20 10:38:19 -05:00
to_dir="$(basename "$archive_name")"
2019-12-05 16:09:52 -06:00
mkdir -p "${to_dir}"
2020-04-20 10:38:19 -05:00
pushd "${to_dir}" || ( echo "${to_dir} does not exist" ; exit 1 )
2020-01-06 11:15:30 -06:00
tar --zstd -xvf "${archive_name}"
2019-12-05 16:09:52 -06:00
echo "Unarchived to: ${to_dir}"
2020-04-20 10:38:19 -05:00
popd || exit 2