Tiny Core Base > TCB Bugs

popask "NO" values differ in keyboard

<< < (2/3) > >>

Rich:
Hi pek
When you click a button, popask exits and returns an exit code. That exit code (0 or 1) will be in the  $?  variable.

This will display the value of the exit code:

--- Code: ---echo $?
--- End code ---

Test it like this for No:

--- Code: ---if [ "$?" == 0 ]
--- End code ---

Rich:
Hi pek
Ignore the previous post. It seems  popask  doesn't use the exit code for this. Try this:

--- Code: ---VAR="`popask "Your text."`"
--- End code ---
The value will be in  $VAR. Those are not single quotes, they are back ticks.

pek:
Hi Rich..
Strangely no matter if  I clicked yes or no, it always give me 0 for $?.

when I click yes

--- Code: ---$ popask
$ 1
$ echo $?
$ 0
--- End code ---

when I click no

--- Code: ---$ popask
$ 0
$ echo $?
$ 0
--- End code ---

So, it actually spitted out 1 or 0 after clicking.. But the $? always gives 0, regardless.

Rich:
Hi pek
You missed the corrected answer I added.

pek:
Yes, I missed this one.


--- Quote from: Rich on September 24, 2021, 12:31:05 AM ---Hi pek
Ignore the previous post. It seems  popask  doesn't use the exit code for this. Try this:

--- Code: ---VAR="`popask "Your text."`"
--- End code ---
The value will be in  $VAR. Those are not single quotes, they are back ticks.

--- End quote ---

This works as intended.
Thank you very much Rich..  It's brilliant :) :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version