i modified a crude script to read .cbz .cbr on linux with gqview
#!/bin/bash
#gqview-comic
#You must have gqview, unrar and unzip
#programs installed on your system.
#Wan Nor Arifin 2006 modified by Evol
#gq1=gqview
#gq2=`ps h -C gqview | awk '{print $5}'`
tmp_folder=/tmp/.gqview-comic-$$-tmp
ppid=$$
#check if another gqview is running
#if [ "$gq1" = "$gq2" ]; then
# number=`ps h -C $gq1 | awk '{print $1}'`
# kill -9 $number
# else
# echo "gqview not running"
#fi
#Make temporary folder
mkdir $tmp_folder
if [ $? == 0 ]; then
echo "Success"
else
echo "Directory exists!"
#remove the temporary folder
rm -rf $tmp_folder
#It is important to remove and recreate the directory
#since there are possibly some files inside the directory
#from script crash.
mkdir $tmp_folder
fi
#check for file types
for file in "$@"; do
case $file in
#zip file
*[.][cC][bB][zZ] )
echo "I find zip file!"
(
unzip -j -o "$1" > -d $tmp_folder
if [ $? == 0 ]; then
echo "Success"
echo "100"; sleep 0.5
else
echo "I'm broken"
echo "100"; sleep 0.5
echo "Sorry. I can't open this file."
#remove the temporary folder
rm -rf $tmp_folder
kill $ppid
fi
) |
echo "Extracting..."
;;
#rar part
*[.][cC][bB][rR] )
echo "I find rar file!"
(
unrar e -o+ "$1" > -d $tmp_folder
if [ $? == 0 ]; then
echo "Success"
echo "100"; sleep 0.5
else
echo "I'm broken"
echo "100"; sleep 0.5
echo "Sorry. I can't open this file."
#remove the temporary folder
rm -rf $tmp_folder
kill $ppid
fi
) |
echo "Extracting..."
;;
#unrecognised
* )
echo "I'm broken badly!!!"
echo "Sorry. I can't recognize this file. You have to rename the file to something that I can recognize.
"
#remove the temporary folder
rm -rf $tmp_folder
exit 1
;;
esac
done
#open files with gqview
gqview $tmp_folder
#remove the temporary folder
rm -rf $tmp_folder
rm /tmp/-d
exit 0