#!/bin/bash DO_JSON=0 MY_PATH=$(dirname $0) DCC_BMC_IP="192.168.1.42" output_results_json() { echo "{" echo " \"dcc_bmc_ip\": \"${DCC_BMC_IP}\"" echo "}" } output_results() { do_json=${1} if [ ${do_json} -eq 1 ]; then output_results_json else echo "dcc_bmc_ip:${DCC_BMC_IP}" fi } ##### MAIN ##### source ${MY_PATH}/general_funcs.bash arg_has_json "$@" if [ $? -eq 0 ]; then DO_JSON=1 fi output_results ${DO_JSON} exit 0