From 7a3dc6f8210e79068130098c5b6bea60b6af767f Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sun, 21 Jul 2024 13:45:16 -0700 Subject: [PATCH] strip initial hyphen from login shells --- home/shrc | 2 +- sh/recombine | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/home/shrc b/home/shrc index 8fdddec..ad5d449 100644 --- a/home/shrc +++ b/home/shrc @@ -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-$$" && diff --git a/sh/recombine b/sh/recombine index fbeed15..2204f52 100644 --- a/sh/recombine +++ b/sh/recombine @@ -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;;