Files
lnx-arch/dots/bin/extract.sh

23 lines
564 B
Bash
Raw Normal View History

2024-06-10 12:37:36 -05:00
#!/usr/bin/env bash
# klevstul :: 24.06
this_file_name=`basename "$0"`
if [ $# -lt 1 ]; then
echo "error: path to file is missing."
echo "usage: '$this_file_name [path_to_file]'"
exit 1
fi
input_file=$1
2024-08-04 14:19:00 -05:00
if [ -f "${input_file}" ] ; then
case "$input_file" in
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf "$input_file";;
*.tar.gz|*.tgz) tar xzvf "$input_file";;
*.tar.xz|*.txz) tar xJvf "$input_file";;
*.zip) unzip "$input_file";;
*.rar) unrar x "$input_file";;
*.7z) 7z x "$input_file";;
2024-06-10 12:37:36 -05:00
esac
fi