summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2015-03-27 09:25:29 +0100
committercos <cos>2015-04-04 13:28:19 +0200
commit3790aea465a8ceb737421d56d836bd0200770e04 (patch)
tree099eb35b82f98fac3b8f1fb255153cdf723582b6
parentebc7c4bc27694c25bd96806c2795f763e2273abb (diff)
downloadmat-3790aea465a8ceb737421d56d836bd0200770e04.zip
Make papersize.sh output papersize & fullname of papersize.
-rwxr-xr-xpapersize.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/papersize.sh b/papersize.sh
index 475bf4d..a05b396 100755
--- a/papersize.sh
+++ b/papersize.sh
@@ -1,12 +1,16 @@
#!/bin/zsh -e
-PAPERSIZE=`lpoptions -p lbla -l|sed --silent 's/^PageSize.*\*//p'`
+PAPERSIZE=`lpoptions -p lbla -l|sed --silent 's/^PageSize.*\*\([^ ]*\).*/\1/p'`
+FULLNAME=`rgrep "$PAPERSIZE" /etc/cups 2>/dev/null|
+ sed --silent 's/.*PaperDimension\(.*\):.*["]\([0-9.[:blank:]]*\)"/\1/p'`
DIMENSIONS=`rgrep "$PAPERSIZE" /etc/cups 2>/dev/null|
sed --silent 's/.*PaperDimension.*["]\([0-9.[:blank:]]*\)"/\1/p'`
MARGINS=`rgrep "$PAPERSIZE" /etc/cups 2>/dev/null|
sed --silent 's/.*ImageableArea.*["]\([0-9.[:blank:]]*\)"/\1/p'`
+echo "Papersize: $PAPERSIZE"
+echo "Fullname: $FULLNAME"
echo "Dimensions in postscript points: $DIMENSIONS"
echo "Margins in postscript points: $MARGINS"