Reputation: 8889
I am interested in automation of Magento installation. I found one nice article with steps, how to achieve this. I downloaded their script and run it from cli:
./mage-install.sh localhost root test "abcABC123" "1.7.0.2"
And get such error:
./mage-install.sh: 21: ./mage-install.sh: Syntax error: "(" unexpected (expecting "}")
I am not familiar with bash, here is a part of code, which is responsible for it:
compareVersions ()
{
typeset IFS='.'
typeset -a v1=( $1 )
typeset -a v2=( $2 )
typeset n diff
for (( n=0; n<4; n+=1 )); do
diff=$((v1[n]-v2[n]))
if [ $diff -ne 0 ] ; then
[ $diff -le 0 ] && echo '-1' || echo '1'
return
fi
done
echo '0'
}
where line 21 is:
typeset -a v1=( $1 )
Can you explain me how to fix it?
Upvotes: 0
Views: 261
Reputation: 4031
The real problem is with the first line of the script:
#!/bin/sh
This specifies what program to use to execute the script when you run it on the command line i.e. ./mage-install.sh
. The writers probably developed it on a system where /bin/sh
is symlink'd to their bash installation, but that's not the case on many systems (for instance I have Crunchbang which uses dash instead).
You can either explicitly run it with bash using bash mage-install.sh blah blah blah
or you can change that first line to point to something that will actually run bash. You can use which bash
to see where it lives but it should be in /bin/bash
Upvotes: 3
Reputation: 8889
I should run script like this:
bash mage-install.sh localhost root test "abcABC123" "1.7.0.2"
Upvotes: 0