Last active
May 22, 2020 10:14
-
-
Save GitMirar/b732317f8861f36a1af0a8953d945dd9 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
# rename binaries after their sha256 sum | |
function rename_sha256 { | |
sha256=`sha256sum "${1}" | sed 's/ .*$//'` | |
oldPath=`readlink -f "$1"` | |
directory=`echo ${oldPath} | sed 's/\(.*\)[/].*/\1/'` | |
newPath="${directory}/${sha256}" | |
echo "$oldPath -> $newPath" | |
mv "${oldPath}" "${newPath}" | |
} | |
for arg in "$@" | |
do | |
rename_sha256 "${arg}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment