Skip to content

Instantly share code, notes, and snippets.

View yaroslavzghoba's full-sized avatar

Yaroslav Zghoba yaroslavzghoba

View GitHub Profile
@kwmiebach
kwmiebach / get_toml_value.sh
Last active June 7, 2025 12:31
Read values from a simple toml file in bash
#######################################################################################
# Bash function get_toml_value() to get the value of a key in a section of a TOML file.
# Versioned here: https://gist.github.com/kwmiebach/e42dc4a43d5a2a0f2c3fdc41620747ab
# Call it like this:
# value=$(get_toml_value "./conf/config.toml" "server_b" "domain")
# Result should be "my123.example.com" in the case of this example file:
# ---------------------------
# [server_a]
# proto = "https"
# domain = "test.example.net"