Thema: Automagisches Entpacken
function t () { if [ ! -e "$1" ]; then echo 'no such file' elif echo "$1" | grep -s '\.g\?[zZ]$' ; then zcat "$1" | less elif echo "$1" | grep -s '\.\([1-9]\|man\)$' ; then nroff -man "$1" | less elif echo "$1" | grep -s '\.pgp$' ; then pgp "$1" filename=`dirname "$1"` less $filename/`basename "$1" '\.pgp'` rm -i $filename/`basename "$1" '\.pgp'` else less $1 fi }
kleine Funktion im .bashrc.
Nicht besonders elegant, aber
sehr praktisch.
function t () {
if [ ! -e "$1" ]; then
echo 'no such file'
elif echo "$1" | grep -s '\.g\?[zZ]$' ; then
zcat "$1" | less
elif echo "$1" | grep -s '\.\([1-9]\|man\)$' ; then
nroff -man "$1" | less
elif echo "$1" | grep -s '\.pgp$' ; then
pgp "$1"
filename=`dirname "$1"`
less $filename/`basename "$1" '\.pgp'`
rm -i $filename/`basename "$1" '\.pgp'`
else
less $1
fi
}