2012-02-02 04:14:58 +02:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
export CMD=nupdf
|
|
|
|
export EXT=pdf
|
|
|
|
|
|
|
|
export i=0
|
|
|
|
|
2012-02-02 04:19:15 +02:00
|
|
|
export PDF_PATH=~/
|
|
|
|
|
|
|
|
echo -e `basename $0` "\t\tVersion: 2012-02-02"
|
2012-02-02 04:14:58 +02:00
|
|
|
echo "Searching for *.$EXT files. It may take a while..."
|
|
|
|
echo " "
|
|
|
|
|
|
|
|
rm -f /tmp/fsel.tmp 2>/dev/null
|
|
|
|
touch /tmp/fsel.tmp
|
2012-02-02 04:19:15 +02:00
|
|
|
for aa in `find ${PDF_PATH} -name "*.$EXT" -type f -print` ; do
|
|
|
|
i=`expr $i + 1` ;
|
|
|
|
echo $i $aa >>/tmp/fsel.tmp ;
|
|
|
|
done
|
|
|
|
|
2012-02-02 04:14:58 +02:00
|
|
|
export B=`cat /tmp/fsel.tmp`
|
2012-02-02 04:19:15 +02:00
|
|
|
if [ "$B" == "" ]; then
|
|
|
|
echo "No pdf file found"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2012-02-02 04:14:58 +02:00
|
|
|
export A=`dialog --menu "Select a File" 0 50 20 $B --stdout`
|
|
|
|
|
|
|
|
if test $A > 0
|
|
|
|
then
|
|
|
|
export C=`grep "^$A" /tmp/fsel.tmp`
|
|
|
|
export D=`echo $C | cut -d' ' -f2 -`
|
|
|
|
$CMD $D
|
|
|
|
else
|
|
|
|
echo "No file selected!"
|
|
|
|
fi
|