init lab bin

This commit is contained in:
ackman678
2019-02-05 19:30:40 -08:00
commit e86353cd6b
15 changed files with 456 additions and 0 deletions

26
shrinkpdf.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
#shrinkpdf - resize pdf to smaller size. Warning: if no second file name is provided, the default behavior is to overwrite the original pdf
# usage:
# shrinkpdf.sh large.pdf
# shrinkpdf.sh large.pdf small.pdf
# dependencies:
# ps2pdf from Ghostscript
# mktemp from GNU Coreutils
#Setup defaults
fn=$1
fn2=$2
set -e #exit if an error
#decide whether to use a provided new file name or too write over the original filename
if [ -z "$fn2" ]; then
#clean up
tmpName=$(mktemp $fn.XXXXXXX)
ps2pdf $fn $tmpName
#echo $tmpName
rm $fn
mv $tmpName $fn
chmod u=rw,go=r $fn
else
ps2pdf $fn $fn2
fi