Created
August 15, 2026 18:45
-
-
Save ilhan-athn7/00cb070a72039e466c2ca25a4fe5927f to your computer and use it in GitHub Desktop.
Magisk set_perm style file attribute fetch tool
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
| file_info() { | |
| local f="$1" | |
| if [ -z "$f" ] || [ ! -e "$f" ]; then | |
| echo "$1" "Usage: file_info <path>" | |
| return 1 | |
| fi | |
| local uid gid perm ctx | |
| uid=$(stat -c '%u' "$f") | |
| gid=$(stat -c '%g' "$f") | |
| perm=$(stat -c '%a' "$f") | |
| ctx=$(stat -c '%C' "$f" 2>/dev/null) | |
| # fallback if stat doesn't support %C (common on toybox/older busybox) | |
| if [ -z "$ctx" ]; then | |
| ctx=$(ls -Zd "$f" | awk '{print $1}') | |
| fi | |
| printf '%s %s %s 0%s %s\n' "$1" "$uid" "$gid" "$perm" "$ctx" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment