DIRTHACK! a Kornshell feature in bash. And the secret of the ${parameter@operator} syntax.

First published at 14:20 UTC on November 16th, 2019.
subscribers

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/…

MORE
CategoryScience & Technology
SensitivityNormal - Content that is suitable for ages 16 and over
DISCUSS THIS VIDEO