#!/bin/bash ## Copy "NAV-CODE" from index.htm to each other webpage, preserving each page's STYLE, SCRIPT-within-head, TITLE, BODY-tag, and its body; Eugene Reimer 2008; ## REQUIREMENTS: ## each page: optional STYLE+SCRIPT-within-head tags, with SCRIPT sections contiguous; body-tag is required; CASE of these tags gets stdized to that shown; ## index.htm: style+script+meta (lowercase) for To-Be-Replicated stuff; STYLE required, SCRIPT+META optional for Unique-To-Page stuff; ## also required is HTML-comment "end nav"; (formerly /head body tags were on one line, but now stdize to being on separate lines); ## USAGE: ## webnavreplicate [-n/--nobackup] [DIRECTORY] --works in CURDIR, unless DIRECTORY-param specified; makes backups unless --nobackup specified; ## webnavreplicate [-b/--backup] [DIRECTORY] --works in CURDIR, unless DIRECTORY-param specified; makes backups if -b specified <==when nobackup DEFAULT!! ## ## The backups enable unchg-nav to undo accidents; this script is run from webput, but may be run separately when testing, or after an accident with --nobackup... BACKUP=1; ##==backup is again the DEFAULT while [ $# -gt 0 ] && [[ $1 == -* ]];do ##parse the options case "$1" in -b|--back*) BACKUP=1 ;; ##backup option (may make nobackup the default??) -n|--nob*) BACKUP= ;; ##no-backup option -v|--verb*) VERBOSE=1 ;; ##verbose-output option (unfinished) --) shift; break ;; ##ender for options esac shift; ##remove that arg done if [ $# -ge 1 ];then cd $1 || exit; fi ##==work in $1 dir, if specified if ! grep -q '