-
-
Save ThatsJustCheesy/bec25a8fd1ff05d197b685b07b0c06f9 to your computer and use it in GitHub Desktop.
bash script that describes typical filesystem objects—lists directories, describes files, and resolves links on the way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
script_canonical_name='?' | |
file="${1:-$(pwd)}" | |
if [[ -h "$file" ]] | |
then | |
echo "$script_canonical_name: is a link to $(readlink "$file")" | |
file=$(realpath "$file") | |
fi | |
if [[ -d "$file" ]] | |
then | |
ls -p "$file" | |
else | |
file "$file" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment