From 10a51943dc26e522689b3c9064b67f6d6055fcce Mon Sep 17 00:00:00 2001 From: Sebastian <379651+czarly@users.noreply.github.com> Date: Tue, 19 Mar 2024 18:43:23 +0100 Subject: [PATCH] fix --- get-shortname.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 get-shortname.sh diff --git a/get-shortname.sh b/get-shortname.sh new file mode 100755 index 00000000..2eae27e9 --- /dev/null +++ b/get-shortname.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# JSON data + +json_file="/root/rpc/reference-rpc-endpoint.json" +if [ ! -f "$json_file" ]; then + exit 1 +fi + +# ID value to search for +search_id=$1 + +# Get the key of the object with the specified ID value +key=$(cat "$json_file" | jq -r "to_entries[] | select(.value.id == $search_id) | .key") + +echo "$key"