#!/bin/bash set -o nounset set -o errexit set -o pipefail readonly PRONAME="$(basename "${0}")"; readonly PROGDIR="$(readlink -f "$(dirname "${0}")")"; readonly ARGS="${@}"; call_scrot() { local dst_dir="${1}"; shift; scrot '%Y-%m-%d-%T_$wx$h_scrot.png' -e 'mv $f '"${dst_dir}" ${@} notify-send "Screenshot saved to ${dst_dir}/$(ls -rt1 "${dst_dir}" | tail -1)" } main() { if [ ${#} -eq 0 ]; then >&2 echo "You must at least provide the path of the directory where " >&2 echo "screenshots will be saved" exit 1 fi call_scrot ${@}; } main ${ARGS} exit 0