Script cleanup

This commit is contained in:
David Tomaschik
2026-07-06 15:59:12 -07:00
parent 22b3f2e049
commit da1ee162c2
13 changed files with 225 additions and 111 deletions

View File

@@ -1,8 +1,22 @@
#!/bin/sh
env > ${TMPDIR}/env-pre
. ${HOME}/.shenv
env > ${TMPDIR}/env-post
for VAR in $(env | cut -d'=' -f1) ; do
/bin/launchctl setenv "${VAR}" "$(eval echo \$${VAR})"
done
set -o nounset
TMP_DIR="${TMPDIR:-/tmp}"
TMP_DIR="${TMP_DIR%/}"
env > "${TMP_DIR}/env-pre" 2>/dev/null || true
if [ -f "${HOME}/.shenv" ]; then
. "${HOME}/.shenv"
fi
env > "${TMP_DIR}/env-post" 2>/dev/null || true
if [ -x "/bin/launchctl" ]; then
for VAR in $(env | awk -F= '/^[a-zA-Z_][a-zA-Z0-9_]*=/ {print $1}') ; do
case "${VAR}" in
_|""|*[!a-zA-Z0-9_]*|[0-9]*) continue ;;
esac
eval "val=\${${VAR}:-}"
/bin/launchctl setenv "${VAR}" "${val}"
done
fi