Project

General

Profile

« Previous | Next » 

Revision 9810

lib/sh/util.sh: added path_parents()

View differences:

util.sh
444 444
EOF
445 445
)"
446 446

  
447
# usage: path_parents path; use ${dirs[@]} # includes the path itself
448
function path_parents()
449
{
450
	echo_func; local path="$1" prev_path=; dirs=()
451
	while test "$path" != "$prev_path"; do
452
		prev_path="$path"
453
		dirs+=("$path")
454
		path="${path%/*}"
455
	done
456
}
457
alias path_parents='declare dirs; "path_parents"'
447 458

  
459

  
448 460
#### verbose output
449 461

  
450 462

  

Also available in: Unified diff