Skip to content

Instantly share code, notes, and snippets.

@caiofaustino
Created March 16, 2021 15:41
Show Gist options
  • Save caiofaustino/f59fcab599dc2529317c43ac9c6313b5 to your computer and use it in GitHub Desktop.
Save caiofaustino/f59fcab599dc2529317c43ac9c6313b5 to your computer and use it in GitHub Desktop.
Sign all files in folder recursively
#!/bin/bash
echo "Starting sign script"
script_path="/your/script/path/sign.sh"
if [ -d "$1" ]; then
echo "Path exists!"
for f in $1/*; do
if [[ $f == *"."[a-z][a-z][a-z] ]]; then
filename=$(basename "$f")
echo "Signing file - $filename"
gpg -ab --default-key <your_key> $f
else
echo "Starting script again with: $f"
$script_path "$f"
fi
done
else
echo "Path not found, please provide valid path as argument!"
fi
echo "Signing finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment