make ~ work in :cd. closes #9

This commit is contained in:
Dylan Araps 2020-08-06 10:29:46 +03:00
parent c9d6c52edf
commit c820159f43
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 8 additions and 0 deletions

8
shfm
View File

@ -321,6 +321,14 @@ main() {
:?)
prompt "cd: " r
# false positive, behavior intentional
# shellcheck disable=2088
case $ans in
'~') ans=$HOME ;;
'~/'*) ans=$HOME/${ans#"~/"}
esac
cd "${ans:="$0"}" >/dev/null 2>&1|| continue
set -- *
y=1 y2=1 cur=$1