bashrc: 從作業系統範本截取

This commit is contained in:
2025-05-02 11:14:19 +08:00
parent 5e616bcd4f
commit 8bb3783246
2 changed files with 34 additions and 141 deletions

View File

@@ -53,4 +53,29 @@ if ! alias imgcat &>/dev/null && ! functions imgcat &>/dev/null && command -v ma
magick "$1" -geometry 800x480 sixel:-
}'
fi
fi
#
# # ex - archive extractor
# # usage: ex <file>
ex ()
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}