add this to .bashrc :
con() {
con OLD NEW
replaces OLD with NEW in the current directory
and tries to cd into it.
cd "${PWD/$1/$2}" || return 1
}
cwd='\w'
echo "${cwd@P}"
same thing as:
echo "${PWD/~/'~'}"
the latter has some minor cornercase flaws:
(if ~ = /home/bud ; PWD = /home/bud1/bin ; "${PWD/~/'~'}" = ~1/bin.
https://www.gnu.org/software/bash/man...
https://fossbytes.com/gnu-bash-4-4-re...