- Basicly, zgv has two modes of operation
- Browser Mode, capable of navigating and operating within the file system
- Viewer Mode
- The viewer mode has two self explanitory subdivisions
- Single image mode
- Slide show mode
- Some of the key underdocumented commands. These are just the ones I think most important not in the help mode.
- ? - context sensitive (but incomplete) help mode
- u - create thumbnails for use in browse mode
- n/t - un/tag image files
- N/T - un/tag all image files
- ^I (TAB) - Kick into slide show of all tagged files
- Return - Go from browse mode to viewing mode for an individual image
- Escape - Go from viewer mode back to browse mode
- Alt-f - show number of image files and tagged image files in the current directory
- : - show details about image file cursor is on
#!/bin/bash -
# ############## security pack ##############################
PATH='/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games:~/bin' ;
hash -r ;
# - Bash Cookbook, 1st ed.,, #14.5
ulimit -H -c 0 -- ;
# - Bash Cookbook, 1st ed.,, #14.6
IFS=$' \t\n' ;
# - Bash Cookbook, 1st ed.,, #14.7
UMASK='002' ;
umask $UMASK ;
# - Bash Cookbook, 1st ed.,, #14.8
\unalias -a
# - Bash Cookbook, 1st ed.,, #14.4
# ############## security pack ##############################
set -e ;
shopt -s nocasematch expand_aliases ;
alias RM='/bin/rm -f 2> /dev/null ' ;
alias MKDIR='/bin/mkdir 2> /dev/null ' ;
alias LS='/bin/ls -A 2> /dev/null ' ;
alias WC='/usr/bin/wc -l 2> /dev/null ' ;
alias GS='/usr/bin/gs' ;
alias EZGV='exec /usr/bin/zgv' ;
USAGE="$0 -h | file.pdf | file.ps" ;
VERSION='$Id: pdfgsview,v 1.3 2008/07/08 11:22:38 dallas Exp dallas $' ;
THEPDFFILE=${1} ;
case ${THEPDFFILE} in
[-/][h?]* )
echo ${USAGE} ;
exit ;
;;
[-/]v* )
echo ${VERSION} ;
exit ;
;;
*.ps )
THETAG=${THEPDFFILE%.ps} ;
;;
*.pdf )
THETAG=${THEPDFFILE%.pdf} ;
;;
* )
exit ;
esac
if [ ! -f ${THEPDFFILE} ] ; then
echo 'File needed' ;
echo ${USAGE} ;
exit ;
fi
if [[ ${THETAG} == */* ]] ; then
THETAG=${THETAG##*/} ;
fi ;
THEDIR1='/tmp/pdfgsimages' ;
THEDIR2="${THEDIR1}/${THETAG}" ;
THEFILES="${THEDIR2}/${THETAG}.%03d.png" ;
for ii in ${!THEDIR*}
do
if [ ! -d ${!ii} ] ; then
RM ${!ii} ;
MKDIR ${!ii} ;
fi ;
done ;
RM ${THEDIR2}/* ;
# THETEMP="/tmp/${THETEMP##*/}" ;
RM ${THEDIR2}/*.png ;
GS -SDEVICE=png16m -sOutputFile=${THEFILES} - ${THEPDFFILE} <<QUIT
QUIT
count=$( LS ${THEDIR2} | WC ) ;
case ${count} in
1 )
EZGV ${THEDIR2}/*.png ;
;;
* )
EZGV ${THEDIR2}/ ;
;;
esac ;
exit ;
The 'security pack' mentioned above are some suggested actions to improve script security mentioned in the O'Reilly 'bash Cookbook'. There are others in the book, but these I judged 'no-brainers', in that they can simply be included and don't seem to even require understanding or any modification to use.