tamalsaha / learn-bash

0 stars 0 forks source link

Template #19

Open tamalsaha opened 4 years ago

tamalsaha commented 4 years ago
#!/bin/bash
set -eou pipefail

SCRIPT_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/..)
SCRIPT_NAME=$(basename "${BASH_SOURCE[0]}")
pushd $SCRIPT_ROOT

# http://redsymbol.net/articles/bash-exit-traps/
function cleanup() {
  popd
}
trap cleanup EXIT