Skip to content

Instantly share code, notes, and snippets.

@ninehills
Created November 20, 2010 10:33
Show Gist options
  • Save ninehills/707747 to your computer and use it in GitHub Desktop.
Save ninehills/707747 to your computer and use it in GitHub Desktop.
Ubuntu下的截图脚本
#!/bin/bash
# Ubuntu下的截图脚本,为其设置一个快捷键即可
# 来自:http://forum.ubuntu.org.cn/viewtopic.php?f=120&t=125239
NOW=`date '+%Y-%m-%d-%H-%M-%S'`
if [ -z $2 ]; then
FNAME=screenshot-${NOW}
else
FNAME="[$2]-${NOW}"
fi
EXT=png
SCRDIR=${HOME}/Picture/snap/
if [ ! -d "${SCRDIR}" ]; then
mkdir -p "${SCRDIR}"
fi
if [ -z $1 ]; then
cmd="import -frame ${SCRDIR}${FNAME}.${EXT}"
else
cmd="import -frame -window $1 ${SCRDIR}${FNAME}.${EXT}"
fi
eval $cmd
echo ${SCRDIR}${FNAME}.${EXT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment