Skip to content

Instantly share code, notes, and snippets.

@agile
Created September 8, 2014 14:01
Show Gist options
  • Save agile/ae871e73eef695609fbb to your computer and use it in GitHub Desktop.
Save agile/ae871e73eef695609fbb to your computer and use it in GitHub Desktop.
Stupid script to rename stupid screenshots for a stupid issue tracker
#!/bin/bash
#
# Rename screenshots into a format Jira won't complain about.. ;P
#
SCREENSHOTDIR=~/
LOCKFILE=$(dirname $0)/$(basename $0).pid
echo "LOCKFILE: ${LOCKFILE}"
if [ -e ${LOCKFILE} ]; then
if ps --no-header $(cat ${LOCKFILE}) >/dev/null 2>&1; then
exit 1
fi
fi
echo $$ > ${LOCKFILE}
watch()
{
while true; do
inotifywait -e CREATE ${SCREENSHOTDIR} && rename 's/[ :]/\_/g' ${SCREENSHOTDIR}/Screenshot*.png;
done
}
watch&
echo $! > ${LOCKFILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment