diff --git a/bin/crc b/bin/crc index be4069d..3eaec1c 100755 --- a/bin/crc +++ b/bin/crc @@ -107,7 +107,15 @@ REL=$(printf %q "$rel") ABS=$(printf %q "$abs") RC_ARGS=$(printf %q "$rc_args") SESS=$(printf %q "$session") -if [ -n "\$ABS" ]; then DIR=\$ABS; else DIR="\$HOME\${REL:+/\$REL}"; fi +if [ -n "\$ABS" ]; then + case "\$ABS" in + "~") DIR=\$HOME ;; + "~/"*) DIR="\$HOME/\${ABS#~/}" ;; + *) DIR=\$ABS ;; + esac +else + DIR="\$HOME\${REL:+/\$REL}" +fi if ! cd "\$DIR" 2>/dev/null; then echo "crc: directory not found on host: \$DIR" >&2 exit 1