mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
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:
parent
057f3ec67e
commit
572dcdab46
3 changed files with 6 additions and 6 deletions
|
|
@ -131,7 +131,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
sha_str=$sha_str[1]
|
sha_str=$sha_str[1]
|
||||||
extra_str+=" SHA $sha_str"
|
extra_str+=" SHA $sha_str"
|
||||||
fi
|
fi
|
||||||
if [[ -h "$progfile" ]]; then
|
if [[ -L "$progfile" ]]; then
|
||||||
extra_str+=" ( -> ${progfile:A} )"
|
extra_str+=" ( -> ${progfile:A} )"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
@ -199,7 +199,7 @@ function _omz_diag_dump_one_big_text() {
|
||||||
builtin echo
|
builtin echo
|
||||||
if [[ -e $ZSH_CUSTOM ]]; then
|
if [[ -e $ZSH_CUSTOM ]]; then
|
||||||
local custom_dir=$ZSH_CUSTOM
|
local custom_dir=$ZSH_CUSTOM
|
||||||
if [[ -h $custom_dir ]]; then
|
if [[ -L $custom_dir ]]; then
|
||||||
custom_dir=$(builtin cd $custom_dir && pwd -P)
|
custom_dir=$(builtin cd $custom_dir && pwd -P)
|
||||||
fi
|
fi
|
||||||
builtin echo "oh-my-zsh custom dir:"
|
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() {
|
function _omz_diag_dump_echo_file_w_header() {
|
||||||
local file=$1
|
local file=$1
|
||||||
if [[ ( -f $file || -h $file ) ]]; then
|
if [[ ( -f $file || -L $file ) ]]; then
|
||||||
builtin echo "========== $file =========="
|
builtin echo "========== $file =========="
|
||||||
if [[ -h $file ]]; then
|
if [[ -L $file ]]; then
|
||||||
builtin echo "========== ( => ${file:A} ) =========="
|
builtin echo "========== ( => ${file:A} ) =========="
|
||||||
fi
|
fi
|
||||||
command cat $file
|
command cat $file
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ _source-from-homebrew() {
|
||||||
|
|
||||||
local _brew_prefix
|
local _brew_prefix
|
||||||
# check default brew prefix
|
# check default brew prefix
|
||||||
if [[ -h /usr/local/opt/chruby ]];then
|
if [[ -L /usr/local/opt/chruby ]];then
|
||||||
_brew_prefix="/usr/local/opt/chruby"
|
_brew_prefix="/usr/local/opt/chruby"
|
||||||
else
|
else
|
||||||
# ok , it is not default prefix
|
# ok , it is not default prefix
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ function _rbfu_rubies_print() {
|
||||||
rb_out="$rb"
|
rb_out="$rb"
|
||||||
|
|
||||||
# If the ruby is a symlink, add @ to the name.
|
# If the ruby is a symlink, add @ to the name.
|
||||||
if [[ -h "$1" ]]; then
|
if [[ -L "$1" ]]; then
|
||||||
rb_out="${rb_out}${fg[green]}@${reset_color}"
|
rb_out="${rb_out}${fg[green]}@${reset_color}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue