tianyun 9 月之前
父節點
當前提交
0ddd926a23
共有 1 個文件被更改,包括 7 次插入6 次删除
  1. 7 6
      sh_config.sh

+ 7 - 6
sh_config.sh

@@ -21,13 +21,14 @@ function gittagpush() {
 alias gittags='git --no-pager tag -l -n'
 
 function reloadrc() {
-    if [[ "$0" =~ "zsh" ]]
-    then
-      echo "正在使用zsh"
-      source ~/.zshrc
+    if [ -n "$ZSH_VERSION" ]; then
+        echo "正在使用zsh"
+        source ~/.zshrc
+    elif [ -n "$BASH_VERSION" ]; then
+        echo "正在使用bash"
+        source ~/.bashrc
     else
-      echo "正在使用bash"
-      source ~/.bashrc
+        echo "无法确定当前 Shell 类型"
     fi
 }