export CLASSPATH=$(JARS=(./lib/*.jar); IFS=:; echo "${JARS[*]}")
If I put this line in a bash_script.sh
and do
chmod +x bash_script.sh
and then run
./bash_script.sh
it gives the error.
Syntax error: "(" unexpected (expecting ")")
How ever I am able to run this thing directly from the prompt and get the expected result. as
$ export CLASSPATH=$(JARS=(./lib/*.jar); IFS=:; echo "${JARS[*]}")
I was wondering what is the reason for this strange behaviour.