commit c54fea44e61b956f6df0c6c1edf5975f8f93df12 parent d1b35e9935fa3a674aff34e3e2d2c563c4a36858 Author: Ed van Bruggen <edvb@uw.edu> Date: Tue, 3 Aug 2021 00:38:26 -0700 bin: Add uz to safely unzip Diffstat:
A | bin/uz | | | 13 | +++++++++++++ |
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/bin/uz b/bin/uz @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +if [[ $# != 1 ]]; then + echo "usage: uz ZIPFILE" + exit 1 +fi + +# TODO don't create new directory if zip already contains one +mkdir "${1%.zip}" +mv "$1" "${1%.zip}" +cd "${1%.zip}" +unzip "$1" +rm -f "$1"