Ubuntu – Problem with Bash script: ‘declare: not found’

bashscripts

I had a script which was running fine but when I ran it today, it says declare: not found. I am using bash shell and path at the starting of the script is correct.

Two flagged lines in my script are as follows:

declare -a RESPONSE
RESPONSE=($RESULT)

It also says ( is unexpected but I guess that is coming up because of the first error.
Worth mentioning point is when I type in declare directly works fine.

declare | grep USER shows

USER=ashfame
USERNAME=ashfame
           values="$SVN_BASH_USERNAME";

So, whats wrong here?

Best Answer

Are you using sh instead of bash? sh (linked to dash) does not support declare keyword, nor the syntax

VAR=(list) 

for initializing arrays.

Related Question