mardi 25 avril 2017

IF ELSE statement

can someone help me with this if/else statement.

I want to ask the question "What format do you want to use?" then depending on if the answer is xml or json then print the output. However if it is not xml or json then code finishes. Any help would be appreciated

!/bin/bash

read -r -e -p "What format do you want to use? json/xml?: " format

if [[ "${format,,}" == "json" ]]; then
    curl=$curl"\"\Content-Type: application/json\"\
else [[ "${format,,}" == "xml" ]]; then
    curl=$curl"\"\Content-Type: application/xml\"\
fi

echo $curl

Aucun commentaire:

Enregistrer un commentaire