-2

I have this code that expects string from the end user:

#!/bin/bash

echo "You are about to deploy the site from STAGING to PRODUCTION, Are you sure? yes/no ";

read continue

if (( "$continue" == "yes" )) ; then
        echo "Yes"
else
        echo "No"
fi

The problem is that the else will never be.

Thanks

SexyMF
  • 10,657
  • 33
  • 102
  • 206
  • 3
    Use `[[` not `((`, see https://linuxconfig.org/bash-scripting-parenthesis-explained –  Jun 20 '16 at 19:22

1 Answers1

0

Use test ([...]), not double-parens:

#!/bin/bash

echo "You are about to deploy the site from STAGING to PRODUCTION, Are you sure? yes/no ";

read continue

if [ "$continue" == "yes" ] ; then
    echo "Yes"
else
    echo "No"
fi
Juan Tomas
  • 4,905
  • 3
  • 14
  • 19