#!/bin/sh -eu
#
# ls-lineage - long-lists each element in the given path, ascending to the root.
# If no arguments are given, then it assumes the current directory.
#
# Usage: ls-lineage [DIRECTORY|FILE] [ARGUMENTS_FOR_LS...]

test "$#" -gt 0 && path=$1 && shift || path=${PWD}
test "${path#/}" = "${path}" && path="${PWD}/${path}"

while test -n "${path}"; do
  ls -l -d "${path}" "$@"
  path=${path%/*}
done | column -t
