Skip to content

Instantly share code, notes, and snippets.

@catwith1hat
Created June 24, 2024 17:38
Show Gist options
  • Save catwith1hat/48a03f24df648d9ae44feba5ce65e7d0 to your computer and use it in GitHub Desktop.
Save catwith1hat/48a03f24df648d9ae44feba5ce65e7d0 to your computer and use it in GitHub Desktop.
#!/bin/sh
while getopts ":d:" opt; do
case ${opt} in
d )
DEPOSIT_JSON=$OPTARG
;;
\? )
echo "Invalid option: $OPTARG" 1>&2
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
;;
esac
done
shift $((OPTIND -1))
if [ -z "$DEPOSIT_JSON" ]; then
echo "Usage: $0 -d <deposit.json> <pubkey_1> <pubkey_2> ..."
exit -1
fi
PUBKEYS="false"
for i in "$@"; do
PUBKEYS+=" or .pubkey==\"$i\""
done
cat "$DEPOSIT_JSON" | jq "map(select($PUBKEYS))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment