When I run this script the first question it asks is "Would you like to use curl? [Y/N]:" to which my reply is often Y or y. However, when I do that the instant output I get is "Unknown!". I'm expecting to see the next question from the code which is "Great, do you want to ignore certificates [Y/N]: "
Can anyone edit my code to make it work as expected? And tell me why?
#!/bin/bash
echo "Build command"
read -r -e -p "Would you like to use curl? [Y/N]: "
curlstring="curl"
if [[ "${input,,}" == "y" ]]; then
read -r -e -p "Great, do you want to ignore certificates [Y/N]: " input
if [[ "$input" == "y" ]]; then
curlstring=$curlstring" -k"
else
curlstring=$curlstring" "
fi echo "$curlstring"
elif [[ "${input,,}" == "n" ]]; then
echo "Bye"
else
echo "Unknown!"
exit 0
fi
Aucun commentaire:
Enregistrer un commentaire