Germán Diago
Germán Diago

Reputation: 7663

bash variable disappearing not in loop

I have this piece in which the variable TESTS_SUCEEDED disappears or its value is unset. I saw many examples in which variables disappear due to subshell starting in loops, but couldn't find any clue about this behaviour.

${SRCDIR}/3rdParty/bin/alxdatabasemanager 
--create-database-with-name=TestAlexandriaDB || exit 1
Src/Tests/Functional/FunctionalTestLibalexandria
TESTS_SUCCEEDED="$?"

#Here variable exists
echo ${TESTS_SUCEEDED}

${SRCDIR}/3rdParty/bin/alxdatabasemanager 
--delete-database-with-name=TestAlexandriaDB || exit 1

#FIXME: Variable nonexisten here or value lost??!! Why?
exit ${TESTS_SUCCEDED}

Could anyone tell me what is going on? Thanks in advance.

Upvotes: 0

Views: 206

Answers (1)

unwind
unwind

Reputation: 399823

You are having spelling issues: TESTS_SUCCEEDED and TESTS_SUCEEDED are not the same thing.

Let's line'em up, to clarify:

TESTS_SUCCEEDED
TESTS_SUCEEDED

Upvotes: 4

Related Questions