From c5ee7bc21587a0a0da32217e23170b3a9f8dee75 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Wed, 24 Jan 2024 14:04:30 -0500 Subject: documentation --- wordpress/export-json.bash | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) (limited to 'wordpress') diff --git a/wordpress/export-json.bash b/wordpress/export-json.bash index d021173..0b5d35a 100644 --- a/wordpress/export-json.bash +++ b/wordpress/export-json.bash @@ -1,22 +1,27 @@ #!/bin/bash # -# export_JSON -# # Synopsis: # -# $ ( -# source export-json.bash -# export_JSON SSH_TTY \ -# SSH_CONNECTION \ -# SSH_CLIENT \ -# SSH_AUTH_SOCK -# ) -# { -# "SSH_TTY": "/dev/pts/0", -# "SSH_CONNECTION": "192.0.2.140 41564 198.51.100.25 22", -# "SSH_CLIENT": "192.0.2.140 41564 22", -# "SSH_AUTH_SOCK": "/tmp/ssh-XXXXcePKJl/agent.36326" -# } +# #!/bin/bash +# . export-json.bash +# export_JSON +# +# Example: +# +# $ ( +# source export-json.bash +# export_JSON SSH_TTY \ +# SSH_CONNECTION \ +# SSH_CLIENT \ +# SSH_AUTH_SOCK +# ) +# +# { +# "SSH_TTY": "/dev/pts/0", +# "SSH_CONNECTION": "192.0.2.140 41564 198.51.100.25 22", +# "SSH_CLIENT": "192.0.2.140 41564 22", +# "SSH_AUTH_SOCK": "/tmp/ssh-XXXXcePKJl/agent.36326" +# } # # This bash function exports shell variables as # JSON ("javascript object notation") strings. @@ -25,19 +30,19 @@ # # JSON is a format that represents data as # Javascript source code so modern programmers -# can read it unlike bash source code. +# can read it unlike bash source code. # # Variable names are given to the function as its # argument list: # -# $ (source export-json.bash; export_JSON PATH) +# $ (source export-json.bash; export_JSON PATH) # # The output is a single JSON object containing # key-value mappings between JSON strings: # -# { -# "PATH": "/usr/local/sbin:[...]" -# } +# { +# "PATH": "/usr/local/sbin:[...]" +# } # # It uses the external tool "jq" to parse string # values placed in jq's argument list by bash and -- cgit v1.2.3