|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#!/bin/sh
# (find-angg ".fvwm/edrx-menus.fvwm")
# (find-angg ".zshrc" "myincr")
# (find-man "1 import")
# (find-angg "bin/Xscreenshot")
# (find-sh0 "Xscreenshot-rect named foo.png")
# (find-sh0 "Xscreenshot-rect")
# (find-fline "/tmp/screenshots/foo.png")
# (find-fline "/tmp/screenshots/")
DIR=/tmp/screenshots
FMT=/tmp/screenshots/ss%02d.png
NFILE=/tmp/screenshots/n
mkdir -p $DIR
cd $DIR || { echo "can't cd to $DIR"; exit 1; }
if [ ! -e $NFILE ]; then
echo 0 > $NFILE
fi
# N=$(cat $NFILE)
# NEWN=$[$N+1]
N () { cat $NFILE; }
Nplus () { echo $[$(N)+1]; }
Incr () { newN=$(Nplus); echo $newN > $NFILE; }
Img () { printf "$FMT\n" $(N); }
doopt () {
# case "_$1_" in
# _last_) printf $FMT $N;;
# __) import $(printf $FMT $NEWN)
# echo $NEWN > $NFILE;;
# _named_) import $2;;
# _test_) echo $N $NEWN;;
# *) echo ERROR;;
# esac
case "_$1_" in
_last_) Img;;
__) import $(Img); Incr;;
_named_) import $2;;
_test_) N; Nplus;;
*) echo ERROR;;
esac
}
doopt $*
return
* (eepitch-bash)
* (eepitch-kill)
* (eepitch-bash)
rm -v /tmp/screenshots/n
. ~/bin/Xscreenshot-rect test
Img
N
Nplus
Incr
N
Incr
N
echo 44 > $NFILE
N
Nplus
Nplus
echo Nplus _ $NFILE
# Nplus > $NFILE
N
cat $NFILE
Nincr
N
Nincr
N
which Nplus
set Nplus
doopt test
N=$(cat $NFILE)
NEWN=$[$N+1]
echo $N $NEWN
echo $NEWN > $NFILE
echo $[2+3]
echo $N
N=44
echo $[$N+3]
M=$[$N+3]
echo $M
cat $NFILE
# Old code:
# mkdir -p /tmp/screenshots
# cd /tmp/screenshots || exit 1
#
# if [ ! -e n ]; then
# echo 0 > n
# fi
#
# N=$[$(<n)+1]
# import ss$(printf %02d $N).png
# echo $N > n