Advertisement
rootbeer

rss2email.py shell wrapper

Feb 9th, 2012
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.54 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # r2e
  4. #
  5. # Wrapper for rss2email.py.
  6.  
  7. PYTHON=python
  8. CODEDIR=$(dirname $(readlink -f $0))
  9. PREFDIR=~/.rss2email
  10.  
  11. set -e
  12.  
  13. #
  14. # override $PREFDIR by passing '-d <dir>' ('-d' must be first).
  15. #
  16. if [ "$1" = "-d" ]; then
  17.         if [ -z "$2" ]; then
  18.                 echo "r2e: -d missing directory" >&2
  19.                 exit 1
  20.         fi
  21.         PREFDIR="$2"
  22.         shift 2
  23. fi
  24.  
  25. if [ ! -d "${PREFDIR}" ]; then
  26.         mkdir -p "${PREFDIR}"
  27. fi
  28.  
  29. cd "$PREFDIR"
  30.  
  31. exec $PYTHON ${CODEDIR}/rss2email.py feeds.dat "$@"
  32.  
  33. #eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement