Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SCRIPT_PATH="${BASH_SOURCE[0]}" Bad substitution

Tags:

variables

bash

On Centos my script work fine. But on Debian Squeeze when I run script, I got:

cpfailover.sh: 30: Bad substitution

Line of script say:

SCRIPT_PATH="${BASH_SOURCE[0]}";

I have seen in many examples, even here, that is a correct line no. where is the problem.

like image 841
abkrim Avatar asked Mar 21 '13 07:03

abkrim


1 Answers

Are you using /bin/sh? On Debian Squeeze, /bin/sh is a symlink to /bin/dash which does not support ${array[0]}.

like image 141
pynexj Avatar answered Sep 20 '22 18:09

pynexj