Scripts to retrieve and install How to Design Programs 2nd edition.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jts bb009e4069 Add `set -euo pipefail` to scripts 2 months ago
.gitignore Add `install-2htdp.bash` 1 year ago
README.md Add `install-2htdp.bash` 1 year ago
get-2htdp.bash Add `set -euo pipefail` to scripts 2 months ago
install-2htdp.bash Add `set -euo pipefail` to scripts 2 months ago

README.md

get-2htdp

A simple bash script to retrieve How to Design Programs 2nd Edition and prepare it for local usage.

What it does

Very simply, this is an otherwise pure-Bash script which uses wget to pull down How to Design Programs and then replaces documentation URLs with links to local copies installed in /usr/share/doc by Racket.

In detail, this script checks if there is a directory in the current directory called "2htdp" and, if not, creates it. Then, it changes to this directory and executes wget with options to, basically, get all necessary files for the book and nothing else. It then deletes the "robots.txt" file, because we don't want that for us humans, and replaces every occurrance of "https://docs.racket-lang.org/" with "file:///usr/share/doc/racket/" in html files.

How it works

Simply download the script and run it. Such as:

git clone https://github.com/Marie-Joseph/get-2htdp.git
cd get-2htdp
bash get-2htdp.bash
# OR
# chmod +x get-2htdp.bash && ./get-2htdp.bash

Installing 2htdp

If you'd like to install the downloaded files to /usr/local/share/doc, as I do so I can use the book without an internet connection, simply run install-2htdp.bash. It requires root, so here's what it does.

This script checks if there is a 2htdp directory and, if it doesn't find it in its directory, calls get-2htdp.bash. If the directory is already there or once it's downloaded, 2htdp is moved to /usr/local/share/doc, which is created if needed.

The script doesn't check anything to determine if the download failed, so use get-2htdp.bash to finish a download. Alternatively, delete an existing 2htdp dir to force a re-download.

License

HtDP is licensed separately and unaffiliated with me. Its license is listed on the first page of the book, which is one click from the link above. These scripts, however, are licensed CC-BY-SA 4.0 International.