Structured Output
Key-Value Line
Print Stable Fields
Many automation scripts print name=value lines so another tool can read the result without guessing column positions.
Program
Play the script to choose a status and see the stable key-value output line.
key_value_line.sh
#!/usr/bin/env bash
status=
service="api"
line="service=$service status=$status"
echo "$line"
#!/usr/bin/env bash
status=
service="api"
line="service=$service status=$status"
echo "$line"
key-value
A key-value line names each field explicitly.
stable field
Keeping field names stable helps downstream tools parse output.
single line
One logical record per line is easy to log and grep.