#! /bin/bash # Last edited on 2024-04-01 16:58:41 by stolfi # Prints the width and height of a PBMPLUS file "$1". # If $1 is not given, uses stdin. # Prints "YUK YUK" and raises status=1 in case of error. if [[ $# -gt 1 ]]; then echo "YUK YUK"; exit 1; fi if [[ $# -eq 1 ]]; then cmd="pnmfile $1" else cmd="pnmfile" fi nxy="`${cmd} | /bin/sed -e '1s/^.* \([0-9][0-9]*\) by \([0-9][0-9]*\).*/\1 \2/'`" nxy=( ${nxy} ) if [[ ${#nxy[@]} -ne 2 ]]; then echo "YUK YUK"; exit 1; fi echo "${nxy[0]}" "${nxy[1]}" exit 0