Created
August 26, 2017 17:58
-
-
Save setzer22/f193c2d709ea191888d00474c8d1143f to your computer and use it in GitHub Desktop.
A small bash script to take a screenshot and save it to your Pictures folder. Requires maim
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 [ "$1" != "retry" ]; then | |
maim -s > /tmp/screenshot-tmp.png | |
fi | |
OUTFILE=$(zenity --file-selection --save --filename=/home/josep/Pictures/screenshot.png) | |
if [ $? -eq 0 ] && [ -f $OUTFILE ]; then | |
zenity --question --text "Image $OUTFILE exists. Do you want to overwrite?" | |
if [ $? -ne 0 ]; then | |
echo "IF" | |
sh $0 retry | |
else | |
echo "ELSE" | |
mv /tmp/screenshot-tmp.png $OUTFILE | |
fi | |
else | |
mv /tmp/screenshot-tmp.png $OUTFILE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment