CrunchBang Linux Pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

CrunchBang Linux Pastebin

Posted by corenominal on Thu 8th Jan 19:26 (modification of post by corenominal view diff)
diff | download | new post

  1. #!/bin/sh
  2. # Directory holding your current PDF ebook.
  3. PDFDIR="current-pdf"
  4. if [ "$1" = "-p" ] || [ "$1" = "--pipemenu" ]; then
  5.     echo "<openbox_pipe_menu>"
  6.     if [ -d $PDFDIR ]; then
  7.         QUERY=""
  8.         if [ "$(ls $PDFDIR/*.pdf 2> /dev/null)" ]; then
  9.             QUERY="$QUERY$PDFDIR/*.pdf "
  10.         fi
  11.         if [ "$(ls $PDFDIR/*.PDF 2> /dev/null)" ]; then
  12.             QUERY="$QUERY$PDFDIR/*.PDF "
  13.         fi
  14.         if [ "$QUERY" = "" ];then
  15.             echo "<item label=\"Error: Ebook directory is empty!\"></item>"
  16.         else
  17.             for file in $QUERY; do
  18.                 LABEL="$(echo $file | sed -e "s/$PDFDIR\///g")"
  19.                 echo "    <item label=\"$LABEL\">"
  20.                 echo "        <action name=\"Execute\">"
  21.                 echo "            <execute>"
  22.                 echo "               evince \"$file\""
  23.                 echo "            </execute>"
  24.                 echo "        </action>"
  25.                 echo "    </item>"
  26.             done
  27.         fi
  28.     else
  29.         echo "<item label=\"Error: Ebook directory not found!\"></item>"
  30.     fi
  31.     echo "</openbox_pipe_menu>"
  32.     exit
  33. else
  34.     if [ -d $PDFDIR ]; then
  35.         if [ "$(ls $PDFDIR/*.pdf 2> /dev/null)" ]; then
  36.             for file in $PDFDIR/*.pdf; do
  37.                 (evince "$file") &
  38.             done
  39.             exit
  40.         else
  41.             zenity --error --text="No ebooks found\! Copy your current ebook to ~/$PDFDIR"
  42.             exit
  43.         fi
  44.     else
  45.         zenity --error --text="Ebook directory does not exist\!"
  46.     fi
  47.     exit
  48. fi

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me