From the manpage:
Exit codes for user-specified buttons must be specified in command line.
Even exit code mean to print result, odd just return exit code.
So, you need to use even exit codes for your buttons
edit:
I was looking for a way to robustly load yad
's output into a bash array, but the --separator
option doesn't seem to support the null byte
. There is however a --quoted-output
for shells that you can use with eval
:
quoted_input=$(
yad --quoted-output \
--separator=' ' \
--form \
--field='Number':NUM 666 \
--field='Text':TEXT 'default text' \
--button='b1':10 \
--button='b2':20 \
--button='b3':30
echo $?
)
eval "array=( $quoted_input )"
# show the array (which stores the results)
declare -p array
No character in the [0x01-0x7f]
range can break it, so it is safe.