Check for non-empty files, not just existance
This commit is contained in:
parent
3ed8265e28
commit
e5ec94af42
|
@ -58,7 +58,7 @@ function omodload {
|
|||
print "$0: no such module: $omodule" >&2
|
||||
continue
|
||||
else
|
||||
if [[ -f "$OMZ/modules/$omodule/init.zsh" ]]; then
|
||||
if [[ -s "$OMZ/modules/$omodule/init.zsh" ]]; then
|
||||
source "$OMZ/modules/$omodule/init.zsh"
|
||||
fi
|
||||
|
||||
|
|
2
init.zsh
2
init.zsh
|
@ -47,7 +47,7 @@ fi
|
|||
|
||||
# Compile the completion dump, to increase startup speed.
|
||||
dump_file="$HOME/.zcompdump"
|
||||
if [[ "$dump_file" -nt "${dump_file}.zwc" || ! -f "${dump_file}.zwc" ]]; then
|
||||
if [[ "$dump_file" -nt "${dump_file}.zwc" || ! -s "${dump_file}.zwc" ]]; then
|
||||
zcompile "$dump_file"
|
||||
fi
|
||||
unset dump_file
|
||||
|
|
|
@ -16,7 +16,7 @@ if is-callable 'dircolors'; then
|
|||
alias ls='ls --group-directories-first'
|
||||
|
||||
if zstyle -t ':omz:alias:ls' color; then
|
||||
if [[ -f "$HOME/.dir_colors" ]]; then
|
||||
if [[ -s "$HOME/.dir_colors" ]]; then
|
||||
eval "$(dircolors "$HOME/.dir_colors")"
|
||||
else
|
||||
eval "$(dircolors)"
|
||||
|
|
|
@ -28,7 +28,7 @@ if [[ "$1" == "-r" || "$1" == "--remove" ]]; then
|
|||
fi
|
||||
|
||||
while (( $# > 0 )); do
|
||||
if [[ ! -f "$1" ]]; then
|
||||
if [[ ! -s "$1" ]]; then
|
||||
print "$0: file not valid: $1" >&2
|
||||
shift
|
||||
continue
|
||||
|
|
|
@ -24,7 +24,7 @@ if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then
|
|||
fi
|
||||
|
||||
while (( $# > 0 )); do
|
||||
if [[ ! -f "$1" ]]; then
|
||||
if [[ ! -s "$1" ]]; then
|
||||
print "$0: file not valid: $1" >&2
|
||||
shift
|
||||
continue
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# Joseph Jon Booker <joe@neoturbine.net>
|
||||
#
|
||||
|
||||
if [[ -f /etc/zsh_command_not_found ]]; then
|
||||
if [[ -s /etc/zsh_command_not_found ]]; then
|
||||
source /etc/zsh_command_not_found
|
||||
fi
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ zstyle ':completion:*:*:ogg123:*' file-patterns '*.(ogg|OGG|flac):ogg\ files *(-
|
|||
zstyle ':completion:*:*:mocp:*' file-patterns '*.(wav|WAV|mp3|MP3|ogg|OGG|flac):ogg\ files *(-/):directories'
|
||||
|
||||
# Mutt
|
||||
if [[ -f ~/.mutt/aliases ]]; then
|
||||
if [[ -s ~/.mutt/aliases ]]; then
|
||||
zstyle ':completion:*:*:mutt:*' menu yes select
|
||||
zstyle ':completion:*:mutt:*' users ${${${(f)"$(<~/.mutt/aliases)"}#alias[[:space:]]}%%[[:space:]]*}
|
||||
fi
|
||||
|
|
|
@ -19,7 +19,7 @@ function _gpg-agent-start {
|
|||
}
|
||||
|
||||
# Source GPG agent settings, if applicable.
|
||||
if [[ -f "${_gpg_env}" ]]; then
|
||||
if [[ -s "${_gpg_env}" ]]; then
|
||||
source "${_gpg_env}" > /dev/null
|
||||
ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'gpg-agent' || {
|
||||
_gpg-agent-start
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
|
||||
cache_file="${0:h}/cache.zsh"
|
||||
if [[ ! -f "$cache_file" ]]; then
|
||||
if [[ ! -s "$cache_file" ]]; then
|
||||
if (( $+commands[npm] )); then
|
||||
# npm is slow; cache its output.
|
||||
npm completion >! "$cache_file" 2> /dev/null
|
||||
|
|
|
@ -21,7 +21,7 @@ if [[ "$OSTYPE" == darwin* ]]; then
|
|||
perl_path="$HOME/Library/Perl/5.12"
|
||||
if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
|
||||
manpath=("$perl_path/man" $manpath)
|
||||
if [[ ! -f "$cache_file" ]]; then
|
||||
if [[ ! -s "$cache_file" ]]; then
|
||||
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
|
||||
source "$cache_file"
|
||||
else
|
||||
|
|
|
@ -51,7 +51,7 @@ zstyle -b ':omz:module:ssh-agent' forwarding '_ssh_agent_forwarding'
|
|||
if is-true "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then
|
||||
# Add a nifty symlink for screen/tmux if agent forwarding.
|
||||
[[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
|
||||
elif [ -f "${_ssh_agent_env}" ]; then
|
||||
elif [[ -s "${_ssh_agent_env}" ]]; then
|
||||
# Source SSH settings, if applicable.
|
||||
source "${_ssh_agent_env}" > /dev/null
|
||||
ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'ssh-agent$' || {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#
|
||||
|
||||
local config_file="$HOME/.wakeonlan/$1"
|
||||
if [[ ! -f "$config_file" ]]; then
|
||||
print "$0: no such device file: $1" >&2
|
||||
if [[ ! -s "$config_file" ]]; then
|
||||
print "$0: invalid device file: $1" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ _z_prefixes=(
|
|||
for _z_prefix in "$_z_prefixes[@]"; do
|
||||
_z_sh="${_z_prefix}/etc/profile.d/z.sh"
|
||||
|
||||
if [[ -f "$_z_sh" ]]; then
|
||||
if [[ -s "$_z_sh" ]]; then
|
||||
source "$_z_sh"
|
||||
break
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue