Fixed download.sh logic for multiple arguments. Removed Readme section about executing script from anywhere. Updated the parsing of URLs to be more specific.

pull/597/head
christos 4 years ago
parent 068255f5e5
commit 08d02b5bf6

@ -20,5 +20,3 @@ Optionally, to download specific topics specify their directories as arguments:
```bash
$ ./scripts/download.sh android concurrency
```
This can be run from anywhere as long as the script doesn't change location

@ -16,7 +16,7 @@ download_for_directory() {
done
# Scrape URLs from markdown files
urls=$(ls | cat *.md 2> /dev/null | egrep -o 'https?://[^ ]+' | grep 'pdf' | tr -d ')')
urls=$(ls | cat *.md 2> /dev/null | egrep -o 'https?://[^ ]+' | grep '\.pdf' | tr -d ')')
for url in "$urls"; do
# Ignore empty URLs
@ -30,7 +30,7 @@ download_for_directory() {
}
# If no directories are supplied, iterate over the entire repo.
if [[ "$#" -ne 1 ]]; then
if [[ "$#" -eq 0 ]]; then
REPO_ROOT_DIR="$(dirname $0)/.."
download_for_directory ${REPO_ROOT_DIR}
else

Loading…
Cancel
Save