#!/bin/sh set -e # Installs launchd agents. agent_dir="${HOME}/Library/LaunchAgents" uid="$(id -u "$(whoami)")" mkdir -p "$agent_dir" for file in "${DOTFILES}"/macOS/LaunchAgents/*.plist; do # get just the base file name, similar to using `basename` but w/o a subshell filename="${file##*/}" path="${agent_dir}/${filename}" echo "$filename" if ! test -e "${path}"; then echo "Installing Agent: ${filename}" cp "${file}" "${path}" launchctl enable "user/${uid}/${filename}" fi done