Skip to content

Instantly share code, notes, and snippets.

@GNOMES
GNOMES / dc.sh
Last active October 29, 2025 03:03
cd backwards to named directoy in current path
# Add to ~/.bashrc
# jump backwards from cwd path
dc() {
cd "${PWD%/$1/*}/$1/" 2>/dev/null || echo "Directory not found: $1"
}
# Function to add tab completion to dc
_dc_complete() {
IFS='/' read -ra dirs <<<"$(pwd)"
local dir_names=("${dirs[@]:1}")