Zsh: replace $(id -u) with ${EUID}
Less subshells spawned.
This commit is contained in:
parent
bc23116aa8
commit
cf8b4b8d7e
@ -23,7 +23,7 @@ if command -v emacsclient > /dev/null; then
|
||||
else
|
||||
VISUAL="$(command -v emacs)"
|
||||
fi
|
||||
if [[ $(id -u) -eq 0 ]]; then
|
||||
if [[ ${EUID} -eq 0 ]]; then
|
||||
# Edit files as root in the Emacs instance run by the current user.
|
||||
VISUAL="$(command -v emacsremote) --sudo --local"
|
||||
fi
|
||||
@ -151,8 +151,8 @@ esac
|
||||
# Run SSH/GPG agents if they are installed and not already started. If they are
|
||||
# started, attempt to inherit them.
|
||||
if command -v keychain > /dev/null; then
|
||||
if [[ $(pgrep --uid $(id -u) ssh-agent)
|
||||
&& $(pgrep --uid $(id -u) gpg-agent) ]]; then
|
||||
if [[ $(pgrep --uid ${EUID} ssh-agent)
|
||||
&& $(pgrep --uid ${EUID} gpg-agent) ]]; then
|
||||
# Set environment variables from files.
|
||||
if [[ -z "${SSH_AUTH_SOCK}" ]]; then
|
||||
source "${HOME}/.keychain/$(hostname)-sh"
|
||||
@ -175,11 +175,11 @@ if command -v keychain > /dev/null; then
|
||||
else
|
||||
# keychain not installed, start SSH/GPG agents if they are not running.
|
||||
if command -v ssh-agent > /dev/null \
|
||||
&& [[ ! $(pgrep --uid $(id -u) ssh-agent) ]]; then
|
||||
&& [[ ! $(pgrep --uid ${EUID} ssh-agent) ]]; then
|
||||
eval $(ssh-agent -t 16H 2> /dev/null)
|
||||
fi
|
||||
if command -v gpg-agent > /dev/null \
|
||||
&& [[ ! $(pgrep --uid $(id -u) gpg-agent) ]]; then
|
||||
&& [[ ! $(pgrep --uid ${EUID} gpg-agent) ]]; then
|
||||
eval $(gpg-agent --daemon --quiet --default-cache-ttl $((60*16)) \
|
||||
--max-cache-ttl $((60*16)))
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user