Change script variable value via Java application

Asked

Viewed 194 times

1

I created a script where inside this script there’s a bond like while. The condition for that while is escolha != 1. Everything works ok, but in the middle of this while i run a Java application where I do some checks and depending on this check I need to change the value of this variable choice to 1 in order to be able to exit the loop. Is there any way to do that? I tried that way:

SS SS

  • 1

    Welcome to Stack Overflow @Fernandol. It is preferable to post even the relevant code in your question instead of screen shots code. To write code in your question leave 4 espaços before you start writing, or paste the code and while selected click the button {} above the editor. You can also read more about formatting the text of a post in: Editing aid

  • Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?

1 answer

1

In the script you will do it:

retorno = $(java -jar VerificaSolucao.jar $numCorA A)

Use the variable retorno in the if.

In Java you will change the line where you try to change a variable that does not exist there and returns the desired value. In the else you will do it:

System.exit(1);

Don’t forget to mark 0 no if, after all you should always flag something, no matter how Java performs. I don’t know if Java sends 0 by default if it doesn’t flag anything.

In fact the convention is returns 0 when everything works well and a negative number when there is some problem.

I would put all the code if you had posted it instead of image.

  • 1

    Thanks, that way it worked.

  • @Fernandol. read this to understand how the site works: [tour].

Browser other questions tagged

You are not signed in. Login or sign up in order to post.