I stored the following script in a file and created an alias to that file in the user's bashrc, then sourced that bashrc:
#!/bin/bash
domain="$1" && test -z "$domain" && exit 2
environment() {
read -sp "Please enter the app DB root password:" dbrootp_1 && echo
read -sp "Please enter the app DB root password again:" dbrootp_2 && echo
if [ "$dbrootp_1" != "$dbrootp_2" ]; then echo "Values unmatched. Please try again." && exit 2 fi
read -sp "Please enter the app DB user password:" dbuserp_1 && echo
read -sp "Please enter the app DB user password again:" dbuserp_2 && echo
if [ "$dbuserp_1" != "$dbuserp_2" ]; then echo "Values unmatched. Please try again." && exit 2 fi
}
environment
When I run alias domain I get this output:
+ /user/nwsm/nwsm.sh x
/user/nwsm/nwsm.sh: line 12: syntax error near unexpected token `}'
user/nwsm/nwsm.sh: line 12: `}'
Why is the syntax error? I didn't recognize a syntax error. Do you? Maybe there is another problem.
I don't see any alien characters in Nano (nor in Visual Studio Code):
