Skip to content

Instantly share code, notes, and snippets.

@webmaster128
Last active December 4, 2017 18:03
Show Gist options
  • Select an option

  • Save webmaster128/aa859df4af851b15b45e183a3baf157b to your computer and use it in GitHub Desktop.

Select an option

Save webmaster128/aa859df4af851b15b45e183a3baf157b to your computer and use it in GitHub Desktop.
An interactive command line tool for Linux and Mac that can show directories and files
__inspect_impl() {
if [ -d "$1" ]; then
#echo -n "Recusive size: "
#du -hs "$1" | awk '{print $1}'
ls -l -h -A "$1"
elif [ -f "$1" ]; then
less "$1"
else
echo "Path '$1' is of unknown type"
return 1
fi
}
inspect() {
if [ "$#" -eq 0 ]; then
inspect .
fi
for var in "$@"
do
if ! __inspect_impl "$var" ; then
return $?
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment