Skip to content

Instantly share code, notes, and snippets.

/print.sh
Created Apr 24, 2017

Embed
What would you like to do?
print files of a directory
#!/bin/sh
LPRCMD='lpr -o media=Custom.100x162mm'
#LPRCMD=echo
# onefile number filename
onefile() {
$LPRCMD -#$1 $2
mv $2 printed
}
allfiles() {
echo .
files=`ls *.png`
sleep 1
for file in $files
do
# if [ $file != '*_*_x?.png' ]
case $file in
*_*_x4.png ) onefile 4 $file ; ;;
*_*_x3.png ) onefile 3 $file ; ;;
*_*_x2.png ) onefile 2 $file ; ;;
*_*_x1.png ) onefile 1 $file ; ;;
esac
done
}
crazy() {
all=`echo *zoo`
for i in $all ; do echo $i ; done ; exit
}
# main
touch do-not-delete-this-empty-file.png
while [ 1 ]
do
allfiles
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.