Bash script - array of strings? -


i'm new bash script coding, i've put want reboot services on server (in case crash)

however, i'm hitting stumbling block @ basic point:

#!/bin/bash  declare -a arr=(tomcat7 nginx mysql); 

...gives error:

script-checks.sh: 3: script-checks.sh: syntax error: "(" unexpected

i've tried quoted well:

declare -a arr=("tomcat7" "nginx" "mysql"); 

i don't understand why i'm getting error though. looks i'm using correct syntax:

http://www.thegeekstuff.com/2010/06/bash-array-tutorial/

please advise (i'm coming perl background, quite different me - appologies if i've missing stupid!)

your script not run bash. suppose uses sh.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -