Skip to content

Instantly share code, notes, and snippets.

@gazon1
Created July 27, 2019 06:50
Show Gist options
  • Save gazon1/ba1dde92aadcee0c02ec56d58c118e38 to your computer and use it in GitHub Desktop.
Save gazon1/ba1dde92aadcee0c02ec56d58c118e38 to your computer and use it in GitHub Desktop.
bash script: wget site with relative path
#!/bin/bash
# credit for catching error:
# https://unix.stackexchange.com/questions/423401/show-error-message-if-bash-script-terminates-due-to-set-e
set -e
err_report() {
echo "Error on line $1"
}
trap 'err_report $LINENO' ERR
URL="some_site/$1"
echo $URL
wget "${URL}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment