From 5b4f0f0cabe4ae5940a9f739a07a0e561c6f4d87 Mon Sep 17 00:00:00 2001 From: David Runge Date: Tue, 19 Mar 2019 15:13:06 +0100 Subject: .zsh.after/functions.zsh: Adding function to display contents of various compressed files. --- .zsh.after/functions.zsh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to '.zsh.after') diff --git a/.zsh.after/functions.zsh b/.zsh.after/functions.zsh index e2af147..16dc6de 100644 --- a/.zsh.after/functions.zsh +++ b/.zsh.after/functions.zsh @@ -200,6 +200,50 @@ ex2() { fi } +lstar() { + if [ -f "$1" ] ; then + case "$1" in + *.bz2) + tar -tvf "$1" --force-local + ;; + *.gz) + tar -tvf "$1" --force-local + ;; + *.rar) + unrar lb "$1" + ;; + *.tar) + tar -tvf "$1" --force-local + ;; + *.tbz2) + tar -tvf "$1" --force-local + ;; + *.tgz) + tar -tvf "$1" --force-local + ;; + *.xz) + tar -Jtvf "$1" --force-local + ;; + *.zip) + unzip -l "$1" + ;; + *.Z) + uncompress $1 + ;; + *.7z) + 7z l "$1" + ;; + *) + echo "Don't know how to look into $1" + exit 1 + ;; + esac + else + echo "'$1' is not a file!" + exit 1 + fi +} + ## RSYNC backupinfo() { -- cgit v1.2.3-54-g00ecf