I am looking to modify bash script to set variable by either command line argument or from user input (read command). if argument passed as command line, script should be executed without asking for user input.
I am able to set variable either command line argument or user input but not both way in same script
#!/bin/sh
ENVIRONMENT_NAME=$1
EMAIL=$2
read ENVIRONMENT_NAME
read EMAIL
echo "$ENVIRONMENT_NAME"
echo "$EMAIL"
if I execute like below read command should take values from $1 and $2.
./<scriptname> <environment_name> <email>