#!/bin/sh main () { if [ ! -n "$1" ]; then print_screen ; exit 0 fi case "$1" in -s) selection ;; *) echo "usage: screenshot [-s]" ;; esac } print_screen () { scrot -q 100 -e 'xclip -selection c -t image/png < $f; mv $f ~/Pictures/screenshots/' } selection () { sleep 0.2 scrot -l mode=edge -i -s -e 'xclip -sel clip -t image/png $f; mv $f ~/Pictures/screenshots/' } main "$@"