Skip to content

Instantly share code, notes, and snippets.

@mspreij
Created July 11, 2022 11:24
Show Gist options
  • Save mspreij/1811890fa632e208f33ec57ef55c7012 to your computer and use it in GitHub Desktop.
Save mspreij/1811890fa632e208f33ec57ef55c7012 to your computer and use it in GitHub Desktop.
lpath ()
{
if [[ -z $1 ]]; then
echo " E: expected path";
echo " lpath shows permissions, user, group for each part of a given path to file or directory (with ls -lad)";
return 1;
fi;
local path=${1#/};
local oldIFS="$IFS";
IFS='/';
local whole='';
local output='';
for part in $path;
do
whole=$whole/$part;
output="$output
$(command ls -lad "$whole")";
done;
echo "$output" | column -t;
IFS="$oldIFS"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment