Skip to content

Instantly share code, notes, and snippets.

@mgielda
mgielda / rotate-landscape.sh
Created April 3, 2015 04:28
rotating landscape files for printing
pdftk infile.pdf cat 1-6east output outfile.pdf
#!/bin/bash
: "${SIF_FILE:=image.sif}"
: "${DEF_FILE:=image.def}"
EXPECTED_FILE_TYPE="a /usr/bin/env run-singularity script executable (binary data)"
RECEIVED_FILE_TYPE=$(file $SIF_FILE | cut -d ":" -f 2 | sed -e 's/^[[:space:]]*//')
if [ "$EXPECTED_FILE_TYPE" != "$RECEIVED_FILE_TYPE" ]; then
echo "Fatal error, $SIF_FILE header is a $RECEIVED_FILE_TYPE"