#!/bin/bash esh=/usr/local/lib/esh/esh if [[ $# -gt 2 ]]; then $esh "$@" else if [[ $# -eq 2 ]]; then out="$2" elif [[ $1 == *.esh ]]; then out="${1%.esh}" else out='-' fi fi $esh -o "$out" "$1" chmod $(stat -c '%a' "$1") "$out" chown $(stat -c '%U:%G' "$1") "$out"