Skip to content

Commit

Permalink
make temp dir creation work cross platform
Browse files Browse the repository at this point in the history
  • Loading branch information
pstadler committed Apr 20, 2023
1 parent 38be480 commit 1d7403a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ticker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -e
LANG=C
LC_NUMERIC=C

SESSION_DIR="${TMPDIR}pstadler-ticker-sh"
: ${TMPDIR:=/tmp}
SESSION_DIR="${TMPDIR%/}/ticker.sh-$(whoami)"
COOKIE_FILE="${SESSION_DIR}/cookies.txt"
CRUMB_FILE="${SESSION_DIR}/crumb.txt"

Expand Down Expand Up @@ -34,7 +35,7 @@ fi
symbols=$(IFS=,; echo "${SYMBOLS[*]}")
fields=$(IFS=,; echo "${FIELDS[*]}")

[ ! -d "$SESSION_DIR" ] && mktemp -q -d "$SESSION_DIR"
[ ! -d "$SESSION_DIR" ] && mkdir -m 700 "$SESSION_DIR"

preflight () {
curl --silent --output /dev/null --cookie-jar "$COOKIE_FILE" "https://finance.yahoo.com" \
Expand Down

0 comments on commit 1d7403a

Please sign in to comment.