fix: Use -L to check for symlinks in conditional expressions (#12457)

This avoids conflicting with a somewhat common global `-h` alias
recommended by [`bat`](https://github.com/sharkdp/bat?tab=readme-ov-file#highlighting---help-messages)

Fixes #12457
This commit is contained in:
Clay Caviness 2024-07-06 12:10:08 -04:00
commit 572dcdab46
3 changed files with 6 additions and 6 deletions

View file

@ -131,7 +131,7 @@ function _omz_diag_dump_one_big_text() {
sha_str=$sha_str[1]
extra_str+=" SHA $sha_str"
fi
if [[ -h "$progfile" ]]; then
if [[ -L "$progfile" ]]; then
extra_str+=" ( -> ${progfile:A} )"
fi
fi
@ -199,7 +199,7 @@ function _omz_diag_dump_one_big_text() {
builtin echo
if [[ -e $ZSH_CUSTOM ]]; then
local custom_dir=$ZSH_CUSTOM
if [[ -h $custom_dir ]]; then
if [[ -L $custom_dir ]]; then
custom_dir=$(builtin cd $custom_dir && pwd -P)
fi
builtin echo "oh-my-zsh custom dir:"
@ -309,9 +309,9 @@ function _omz_diag_dump_check_core_commands() {
function _omz_diag_dump_echo_file_w_header() {
local file=$1
if [[ ( -f $file || -h $file ) ]]; then
if [[ ( -f $file || -L $file ) ]]; then
builtin echo "========== $file =========="
if [[ -h $file ]]; then
if [[ -L $file ]]; then
builtin echo "========== ( => ${file:A} ) =========="
fi
command cat $file