1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-11-09 15:39:03 -08:00

strip initial hyphen from login shells

This commit is contained in:
Connor Olding 2024-07-21 13:45:16 -07:00
parent 83508f61ff
commit 7a3dc6f821
2 changed files with 2 additions and 2 deletions

View file

@ -5,7 +5,7 @@ unset FANCY; _=: && [ -z $_ ] && FANCY=1 || FANCY=0 # detect zsh and bash
if [ "$FANCY" = 0 ]; then . ~/.prep; fi # handle stuff like /etc/profile and $PATH
# combine and load everything containing "YES_MYSHELL" in ~/sh/:
[ -z "${0##/*}" ] && sh=zsh || sh="$0" # zsh replaces $0, so hardcode it
[ -z "${0##/*}" ] && sh=zsh || sh="${0#-}" # zsh replaces $0, so hardcode it
{ [ -d "${XDG_CACHE_HOME:="$HOME/.cache"}" ] || mkdir "$XDG_CACHE_HOME"; } &&
{ [ -d "$XDG_CACHE_HOME/shrc" ] || mkdir "$XDG_CACHE_HOME/shrc"; } &&
cache="$XDG_CACHE_HOME/shrc/$sh-$$" &&

View file

@ -2,7 +2,7 @@
# FAKE_COMPAT
cd ~/sh && unset IFS || exit
[ -z "${0##/*}" ] && sh=zsh || sh="$0" # zsh replaces $0, so hardcode it
[ -z "${0##/*}" ] && sh=zsh || sh="${0#-}" # zsh replaces $0, so hardcode it
case "$sh" in
(ash) SH=ASH;;
(bash) SH=BASH;;