From c820159f43456d6461be8f3884b79701d8aee419 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 6 Aug 2020 10:29:46 +0300 Subject: [PATCH] make ~ work in :cd. closes #9 --- shfm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shfm b/shfm index eda6217..e2da4b1 100755 --- a/shfm +++ b/shfm @@ -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