Last active
July 10, 2020 21:06
-
-
Save CodeLongAndProsper90/e4bfcf5b7d5cb4556a0177fe30e4264f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/bin/bash | |
if ! test -d ~/Screenshots | |
then | |
mkdir ~/Screenshots | |
fi | |
if ! command -v scrot &> /dev/null | |
then | |
echo "scrot not installed or missing from \$PATH. Cannot continue." | |
echo "Stop." | |
exit 1 | |
fi | |
if [ "$1" == "instant" ] || [ "$1" == "i" ] | |
then | |
scrot ~/Screenshots/`date +%s`.png | |
elif [ "$1" == "gimp" ] || [ "$1" == "g" ] | |
then | |
if ! command -v gimp &> /dev/null | |
then | |
echo "gimp not installed or missing from \$PATH. Cannot continue." | |
echo "Stop." | |
exit 1 | |
fi | |
scrot ~/Screenshots/`date +%s`.png | |
gimp ~/Screenshots/`date +%s`.png | |
rm -f ~/Screenshots/`date +%s`.png | |
elif [ "$1" == "delay" ] || [ "$1" == "d" ] | |
then | |
scrot ~/Screenshots/`date +%s`.png --delay "$2" | |
else | |
echo "[i]nstant: Take a screenshot" | |
echo "[g]IMP: Open in the GIMP" | |
echo "[d]elay: Delay $2 seconds" | |
echo "" | |
echo "Exit status 0: Finshed" | |
echo "Exit status 1: Missing dependences" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment