Files
2026-05-06 11:49:16 +02:00

49 lines
1.0 KiB
Plaintext

detect_shell(){
if [ -n "$BASH_VERSION" ]; then
shell="bash"
elif [ -n "$ZSH_VERSION" ]; then
shell="zsh"
elif [ -n "$KSH_VERSION" ]; then
case "$KSH_VERSION" in
*"MIRBSD"*) shell="mksh" ;; # MirBSD Korn shell
*) shell="ksh" ;;
esac
elif [ -n "$FISH_VERSION" ]; then
shell="fish"
elif [ -n "$tcsh" ]; then
shell="tcsh"
elif [ -n "$version" ]; then
shell="csh"
else
# Fallback: try process name
shell=$(ps -p $$ -o comm= 2>/dev/null)
case "$shell" in
dash) shell="dash" ;;
sh) shell="sh (unknown variant)" ;;
ash) shell="ash" ;;
*) shell="unknown" ;;
esac
fi
echo $shell
}
shell=`detect_shell`
## echo "Detected shell: $shell"
case "${shell:-}" in
zsh)
alias ld="ls -d --color=auto .*(^D)"
# Add more aliases here
;;
bash)
alias ld="ls -d .[!.]*" ;;
# Add more aliases here
esac