3 # Purpose: extract archives via smart frontend
4 # Authors: grml-team (grml.org), (c) Matthias Kopfermann, (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 # Latest change: Sam Mai 27 15:12:16 CEST 2006 [mika]
8 ################################################################################
10 autoload -U colors && colors
15 $fg_bold[red]Really decompress $fg_bold[magenta]${file}$fg[default]? Press y or Y for YES
16 or any other key for NO $fg[default]
20 $fg_bold[green]Okay, I will not uncompress the file $fg_bold[magenta]${file}$fg[default]$fg[default] as requested.
23 decision="read -q '?$qprompt'"
24 (( ${+PAGER} )) || local PAGER=less
32 $PAGER && eval $decision && tar -xvjf $file \
33 || print $nothing_to_do ;;
35 tar -tvzf $file | $PAGER && eval $decision \
37 || print $nothing_to_do ;;
39 bzip2 -tv $file | $PAGER && eval $decision \
40 && bzip2 -vd $file || print $nothing_to_do ;;
42 gzip -tv $file | $PAGER && eval $decision \
43 && gzip -d $file || print $nothing_to_do ;;
45 tar -tvf $file | $PAGER && eval $decision \
46 && tar xvf $file || print $nothing_to_do ;;
48 tar -tvzf $file | $PAGER&& eval $decision \
49 && tar xzvf $file || print $nothing_to_do ;;
51 unzip -tv $file | $PAGER&& eval $decision \
52 && unzip $file || print $nothing_to_do ;;
54 uncompress -tv $file | $PAGER && eval $decision \
55 && uncompress -v $file || print $nothing_to_do ;;
57 unrar t $file | $PAGER && eval $decision \
58 && unrar x $file || print $nothing_to_do ;;
60 lzop -t $file | $PAGER && eval $decision \
61 && lzop -x $file || print $nothing_to_do ;;
63 echo 'Error. Not the expected arguments!'
64 echo "Usage: $0 file" ; exit 1 ;;
67 echo "'$file' is not a valid file"
70 ## END OF FILE #################################################################