Skip to content

Instantly share code, notes, and snippets.

@olekhy
Created January 31, 2024 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olekhy/c1d91b49f4f7a4b5401d4a2088a7b469 to your computer and use it in GitHub Desktop.
Save olekhy/c1d91b49f4f7a4b5401d4a2088a7b469 to your computer and use it in GitHub Desktop.

Notes

inode_number=$(stat -c '%i' "$1")
#unique_id=$(echo "$inode_number" | sha1sum | awk '{print substr($1, 1, 4)}')
#unique_id=$((0x$(echo -n "$inode_number" | sha1sum | awk '{print $1}') % 4294967296))
unique_id=$((0x$(echo -n "$inode_number" | sha1sum | cut -c 1-8) % 10000))
echo $unique_id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment