mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +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]
|
||||
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
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ _source-from-homebrew() {
|
|||
|
||||
local _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"
|
||||
else
|
||||
# ok , it is not default prefix
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ function _rbfu_rubies_print() {
|
|||
rb_out="$rb"
|
||||
|
||||
# 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}"
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue