0

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.

1
  • How do you know it disappeared? Maybe exit 1 on a previous line exited your script before exit ${TESTS_SUCCEDED} had a chance to use it? Commented Feb 8, 2013 at 12:32

1 Answer 1

4

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.