Skip to content

Instantly share code, notes, and snippets.

@lersveen
Last active April 14, 2023 13:55
Show Gist options
  • Save lersveen/fc974e003171ec97647f5594ba83a00a to your computer and use it in GitHub Desktop.
Save lersveen/fc974e003171ec97647f5594ba83a00a to your computer and use it in GitHub Desktop.
I am so sorry.
#!/bin/sh
#
# such file inspector, much doge
#
self() {
cat <<EOF
Wow
Such self
Much recursion
▄ ▄
▌▒█ ▄▀▒▌
▌▒▒█ ▄▀▒▒▒▐
▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌
▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌
▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐ Very doge
▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌
▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌
▌▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐
▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌
▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐
▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌
▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐
▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌
▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀
▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀
▒▒▒▒▒▒▒▒▒▒▀▀
EOF
}
if test -f "$1"; then # True if file exists and is a regular file.
if ! test -r "$1"; then # True if file exists and is readable.
echo "such file, no read"
elif test -s "$1"; then # True if file exists and has a size greater than zero.
if test -x "$1"; then # True if file exists and is executable.
if [ "$(realpath "$0")" = "$(realpath "$1")" ]; then
self
else
echo "much file, very execute"
fi
elif test -w "$1"; then # True if file exists and is writable.
echo "much file, many writes"
else
echo "much file"
fi
else
echo "such file, very empty"
fi
elif test -L "$1"; then # True if file exists and is a symbolic link.
echo "very symlink, much wow"
elif test -d "$1"; then # True if file exists and is a directory.
echo "such directory"
elif test -S "$1"; then # True if file exists and is a socket.
echo "Such socket, many wow"
elif test -e "$1"; then # True if file exists (regardless of type).
echo "Such file, very mystery"
else
echo "very nope"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment