58 lines
1.7 KiB
Bash
58 lines
1.7 KiB
Bash
|
ch() {
|
||
|
curl -s "https://cheat.sh/$1" | less
|
||
|
}
|
||
|
|
||
|
exf() {
|
||
|
case "$1" in
|
||
|
*.tar.bz2) tar xjf "$1" ;;
|
||
|
*.tar.gz) tar xzf "$1" ;;
|
||
|
*.tar.xz) tar xJf "$1" ;;
|
||
|
*.tbz2) tar xjf "$1" ;;
|
||
|
*.tgz) tar xzf "$1" ;;
|
||
|
*.tar) tar xf "$1" ;;
|
||
|
*.zip) unzip "$1" ;;
|
||
|
*.7z) 7z x "$1" ;;
|
||
|
*.iso) 7z x "$1" ;;
|
||
|
*.rar) unrar x "$1" ;;
|
||
|
*) echo "'$1' cannot be extracted" ;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
exfl() {
|
||
|
for F in "$@"
|
||
|
do
|
||
|
if [ -f "$F" ]; then
|
||
|
exf "$F"
|
||
|
else
|
||
|
echo "'$F' is not a valid file"
|
||
|
fi
|
||
|
done
|
||
|
}
|
||
|
|
||
|
exd() {
|
||
|
case "$1" in
|
||
|
*.tar.bz2) b=${1%.tar.bz2}; mkdir -p "$b">/dev/null; tar xjf "$1" -C "$b" ;;
|
||
|
*.tar.gz) b=${1%.tar.gz}; mkdir -p "$b">/dev/null; tar xzf "$1" -C "$b" ;;
|
||
|
*.tar.xz) b=${1%.tar.xz}; mkdir -p "$b">/dev/null; tar xJf "$1" -C "$b" ;;
|
||
|
*.tbz2) b=${1%.tbz2}; mkdir -p "$b">/dev/null; tar xjf "$1" -C "$b" ;;
|
||
|
*.tgz) b=${1%.tgz}; mkdir -p "$b">/dev/null; tar xzf "$1" -C "$b" ;;
|
||
|
*.tar) b=${1%.tar}; mkdir -p "$b">/dev/null; tar xf "$1" -C "$b" ;;
|
||
|
*.zip) b=${1%.zip}; unzip "$1" -d "$b" ;;
|
||
|
*.7z) b=${1%.7z}; 7z x -o"$b" "$1" ;;
|
||
|
*.iso) b=${1%.iso}; 7z x -o"$b" "$1" ;;
|
||
|
*.rar) b=${1%.rar}; rar x "$1" "$b" ;;
|
||
|
*) echo "'$1' cannot be extracted" ;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
exdl() {
|
||
|
for F in "$@"
|
||
|
do
|
||
|
if [ -f "$F" ]; then
|
||
|
exd "$F"
|
||
|
else
|
||
|
echo "'$F' is not a valid file"
|
||
|
fi
|
||
|
done
|
||
|
}
|