0

I am having my bash file like below.

#!/bin/sh


EXIT_CODE=0
ERROR_MESSAGES=("Error1")


ERROR_MESSAGES+=("Error1")
ERROR_MESSAGES+=("Error2")
ERROR_MESSAGES+=("Error3")

Getting error Text.sh: 5: Syntax error: "(" unexpected

sh Text.sh will throw error any info/suggestions here ?

Coder
  • 49
  • 6
  • `/bin/sh` is not bash. `/bin/bash` is bash – KamilCuk Jan 23 '23 at 07:27
  • No, with `#!/bin/sh` you have a POSIX shell script that does not have arrays.... (happens -- we've all been there -- about 25 years ago....) – David C. Rankin Jan 23 '23 at 07:28
  • You have to actually **use** bash in order to to use bash arrays. Run your program with `bash SCRIPTNAME`. BTW, you don't have an **empty** array in your code. – user1934428 Jan 23 '23 at 10:12

0 Answers0