I am struggling to understand why the bash -e
option exits this script.
It happens only when the expression calculated gives 0
:
#!/bin/bash
set -ex
table_year=( 1979 1982 1980 1993 1995 )
year=$1
let indice=year-1
real_year=${table_year[$indice]}
echo OK $real_year
Is is ok when:
./bash_test_array 2
but not when:
./bash_test_array 1
indice
is this case equals to 0
. Why the -e
option causes an exit ?