dotfiles/systemd/usr/bin/save-environment-variables

18 lines
351 B
Bash
Executable file

#!/usr/bin/env zsh
output=$1
shift
source $HOME/.profile
# Make sure the output directory exists.
[[ -d "$(dirname $output)" ]] || mkdir -p "$(dirname $output)"
echo "[Service]" > "$output"
# Write down all the environment variables.
for env in $@; do
echo "Environment=\"${env}=${(P)env}\""
done >> "$output"
systemctl --user daemon-reload