#!/bin/sh ## ## SCRIPT: 00_multi-pdf-files_linksDownHTMLpage_echo_for-loop.sh ## ## PURPOSE: Generate an HTML file providing links to a set of ## user-selected '.pdf' files in the current directory. ## ## NOTE: ## Many old texts, such as math texts from the 1800's, are ## available on line via projects such as the Gutenberg project. ## ## This utility makes it easy to make a collection of such ## 'ebooks' available via an HTML page. ## ## METHOD: Uses the 'echo' command to build the HTML statments. ## ## Shows the HTML file in HTML-viewer $HTMLVIEWER, and ## starts-up the HTML file in the editor $TXTEDITOR. ## ## $HTMLVIEWER and $TXTEDITOR can be set by the user. ## ## This script puts the '.htm' HTML file in the directory ## with the '.pdf' files. ## ## HOW TO USE: Using the Nautilus file manager, navigate to a ## directory and select a set of '.pdf' files. ## Right-click and choose this script to run (name above). ## ########################################################################### ## Script ## Created: 2012feb28 Based on a similar script in the 'IMAGEtools' group. ## Changed: 2012mar04 Put the ... string on 2 lines. ## Changed: 2012may11 Changed script name in comments above and touched up ## the comments. ####################################################################### ## FOR TESTING: (show statements as they execute) # set -x ################################### ## Set the htm output file name. ################################### # HTMFILE="temp.htm" HTMFILE="00_temp_PDFfileLINKS_downThePage.htm" if test -f "$HTMFILE" then rm "$HTMFILE" fi ####################################### ## Get the current directory. ####################################### CURDIR="`pwd`" ####################################### ## Put the 'head', 'title', and 'intro' ## sections in the HTML file. ####################################### echo " Title Goes Here - PDF Files

Title Goes Here - PDF Files

subtitle goes here

More links may be added in the future.

Introduction :

    " > "$HTMFILE" ################################### ## START THE LOOP on the filenames. ################################### FILECNT=0 for FILENAME do FILECNT=`expr $FILECNT + 1` ############################################################# ## Get the file extension and check that it is for a PDF file. ## (Assumes one period in the filename, at the extension.) ## COMMENTED, for now. ############################################################# # FILEEXT=`echo "$FILENAME" | cut -d'.' -f2` # if test "$FILEEXT" -ne "pdf" -a "$FILEEXT" -ne "PDF" # then # continue # fi ################################################################ ## Write out the line-item and anchor-link tags for the PDF file. ################################################################ echo "
  • $FILENAME " >> "$HTMFILE" done ## END OF LOOP: for FILENAME #################################################### ## END OF FILES LOOP. Write out bottom of HTML file. #################################################### echo "

Bottom of the Title Goes Here - PDF Files page.

To return to a previously visited web page location, click on the
Back button of your web browser, a sufficient number of times.
OR, use the History-list option of your web browser.
OR ...

< Go to Start of PDF links, above. >
< Go to Top of Page, above. >

Page created 2012 xxx 00.

" >> "$HTMFILE" ################################### ## SHOW HTML FILE in a web browser. ################################### ## . $HOME/.gnome2/nautilus-scripts/.set_VIEWERvars.shi . $HOME/.freedomenv/feNautilusScripts/set_DIR_NautilusScripts.shi . $DIR_NautilusScripts/.set_VIEWERvars.shi $HTMLVIEWER "$HTMFILE" & ################################## ## Put HTML FILE in a text editor. ################################## $TXTEDITOR "$HTMFILE"