Skip to content

Instantly share code, notes, and snippets.

@naftulikay
Last active August 29, 2015 14:00
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 naftulikay/11244323 to your computer and use it in GitHub Desktop.
Save naftulikay/11244323 to your computer and use it in GitHub Desktop.
Create Signatures and Checksums for Multiple Files at Once
#!/bin/bash
# needs: apt-get install gnupg parallel
# for mybackup.tar.gz.aa, mybackup.tar.gz.ab, etc.
find . -maxdepth 1 -type f -iname "mybackup.tar.gz.??" | parallel --gnu \
-j 8 --workdir "$PWD" '
gpg --armor --detach-sig "{}" ;
echo -n "$(shasum "{}" | cut -b 1-40)" > "{}.sha" ;
echo -n "$(md5sum "{}" | cut -b 1-32)" > "{}.md5" ;
'
# using 8 workers, generate signatures and checksums for all found files above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment