11 lines
		
	
	
		
			220 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
		
			220 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
# Jump to a parent directory
 | 
						|
dir=$({
 | 
						|
  _path=$PWD
 | 
						|
  while [[ -n "$_path" && "$_path" != "/" ]]; do
 | 
						|
      _path=$(dirname "$_path")
 | 
						|
      echo "$_path"
 | 
						|
  done
 | 
						|
} | grep -i "$*" | tail -1) && cd "$dir"
 |