Try this
Run the script either as:
bash script.sh
or just:
./script.sh
When bash is run using the name sh, it disables most of its extensions, such as the [[ testing operator.
Since you have the #!/bin/bash shebang line, you don't need to specify the shell interpreter explicitly on the command line. Running the script as a command will use that line to find the shell.
Let me know if this was helpful.
Regards,
Jerry
|