Created
June 22, 2014 10:37
-
-
Save huwan/43e58f88938daa0098f0 to your computer and use it in GitHub Desktop.
打印日历笔记本的今明两天(2014年)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
#yesterday=`date -d '-1 day' +%Y%m%d` | |
today=`date +%Y%m%d` | |
pagebegin=`date -f <(seq 20140101 $today) +%F 2>/dev/null |wc -l` | |
pageend=$(($pagebegin+1)) | |
filename="daydayup.pdf" | |
username="printer" | |
if [ ! -f hist.ory ]; then | |
echo "-1" > hist.ory | |
fi | |
n=`cat hist.ory` | |
if [ $n -eq $pagebegin -o $n -eq $(($pagebegin-1)) ]; then | |
echo "Already print these pages!" | |
else | |
echo "lp -U $username -P $pagebegin-$pageend -o sides=two-sided-long-edge $filename" | |
lp -U $username -P $pagebegin-$pageend -o sides=two-sided-long-edge $filename | |
echo "$pagebegin" > hist.ory | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
自己会将有日历的笔记纸打印出来,当然是有需要的时候打印出当天和第二天的,而不是一次打印一年的。