Skip to content

Instantly share code, notes, and snippets.

@GNOMES
GNOMES / dc.sh
Last active April 27, 2025 05:51
cd backwards to named directoy in current path
# Add to ~/.bashrc
# Function to jump backwards from cwd path
dc() {
# attempt to cd to desired directory
cd "$(pwd | sed "s|$1\/.*|$1\/|")" || echo "Directory not found: $1"
}
# Function to add tab completion to dc
_dc_complete() {
local cur=${COMP_WORDS[COMP_CWORD]} # The current word being typed