File: tinpp

package info (click to toggle)
tin 981002-2
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 3,088 kB
  • ctags: 4,969
  • sloc: ansic: 46,800; sh: 1,655; makefile: 1,144; yacc: 699; perl: 103
file content (51 lines) | stat: -rwxr-xr-x 896 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Tin Newsreader post-processor
# $1 is the filename that has been uudecoded
# This is just a sample script - It is very Linux oriented.
# TODO:
#	Eliminate case issues
#	Check for gz composites (eg: .tar.gz) accordingly
#	Option to decide to list and/or extract archives
#	If there anyway we can grep mailcap to do all this ?
#

[ ! -f "$1" ] && exit 1

case ${1##*.} in
	gz)
		echo "Can't differentiate gzip/tar gzip yet"
		;;

	tgz)
		tar -ztvf $1
		;;

	gif|jpg|GIF|JPG)
		[ -z "$DISPLAY" ] && zgv $1 || xv $1
		;;

	txt|TXT)
		${EDITOR:=vi} $1
		;;

	zip)
		unzip -l $1
		;;


	avi)
		[ -z "$DISPLAY" ] && echo "No text mode viewer. Sorry." || xanim $1
		;;

	*)
		echo "Unsupported or missing suffix: ${1##*.}"
		file $1
		;;
esac

echo ""

echo "Press <RETURN> to keep $(basename $1) or anything else to remove it."
read ans
[ -n "$ans" ] && echo "Removing $1" && rm -f $1

# end of tinpp