+ extract.sh
This commit is contained in:
22
dots/bin/extract.sh
Executable file
22
dots/bin/extract.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
12
dots/lf/lfrc
12
dots/lf/lfrc
@@ -94,17 +94,7 @@ cmd trash %trash-put $fx
|
|||||||
|
|
||||||
# extract the current file with the right command
|
# extract the current file with the right command
|
||||||
# (xkcd link: https://xkcd.com/1168/)
|
# (xkcd link: https://xkcd.com/1168/)
|
||||||
cmd extract ''${{
|
cmd extract %extract.sh "$f"
|
||||||
set -f
|
|
||||||
case $f in
|
|
||||||
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
|
|
||||||
*.tar.gz|*.tgz) tar xzvf $f;;
|
|
||||||
*.tar.xz|*.txz) tar xJvf $f;;
|
|
||||||
*.zip) unzip $f;;
|
|
||||||
*.rar) unrar x $f;;
|
|
||||||
*.7z) 7z x $f;;
|
|
||||||
esac
|
|
||||||
}}
|
|
||||||
|
|
||||||
# compress current file or selected files with tar and gunzip
|
# compress current file or selected files with tar and gunzip
|
||||||
cmd tar ''${{
|
cmd tar ''${{
|
||||||
|
|||||||
Reference in New Issue
Block a user