1

This question already has an answer here:

I have a shell script that reads data from a file and stores it into an array. When i execute the script like bash scriptname.sh i dont get any errors but when i execute it using sh scriptname.sh i get errors like array deceleration not found some syntax errors like parentheses are expected.

why differences are coming between these two approaches??

marked as duplicate by Wildcard, Community Nov 2 '16 at 10:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • In particular see this answer. Since you're using Ubuntu, sh is really dash, not bash. So this means you have some "bashisms" in your script. – Wildcard Nov 2 '16 at 10:23
  • Thanks .The links mentioned by you tells that there are difference between the features of these shells. – vaibhav kumar Nov 2 '16 at 10:41