I have 2 custom buttons in my yad --form. The user input aka results get redirected into a .txt file for later use. Thats working fine.
But it seems like the exit code is not given to STDOUT anymore, when I'm redirecting in this way. But I need the exit code to decide how to move on, of course.
Am I on the right path here? Is there another solution that still delivers the exit codes to STDOUT?
yad --title="egPorSS - TYPO3 Constants Setup" --center --borders="20" --width="500" --separator="\n" 2> /dev/null \
--form \
--field="egON API-Key":TEXT \
--field="Host for AJAX-Requests":TEXT \
--field="SOAP-Username":TEXT \
--field="SOAP-Password":TEXT \
--field="SOAP-URL:":TEXT \
--field="SEPA-Service":CHK \
--field="Base-Provider":CHK \
--field="Digital Signature":CHK \
--field="Company name":TEXT \
--field="Street, Number":TEXT \
--field="City":TEXT \
--button="Discard entries":1 \
--button="Write to DB":0 > ./temp/constants_modified.txt # Write entries to .txt file.
# if Button "Write to DB" is pressed, ask again, before manipulating DB
if [ $? -eq 0 ]; then
yad --title="egPorSS - TYPO3 Constants Setup" --center --borders="20" 2> /dev/null \
--text="Write changes to constants field in ${DB} now?" \
--button="No, discard":0 \
--button="Yes, write":1
# if "Yes, write" => modify ./temp/constants_${DB}.typoscript" and coll pushConstantsDB()
if [ $? -eq 1 ]; then
sed -i "s/plugin.tx_egon_pi1.system.apiKey.*/plugin.tx_egon_pi1.system.apiKey = ${modified[0]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.system.host.*/plugin.tx_egon_pi1.system.host = ${modified[1]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.soap.user.*/plugin.tx_egon_pi1.soap.user = ${modified[2]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.soap.password.*/plugin.tx_egon_pi1.soap.password = ${modified[3]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.soap.url.*/plugin.tx_egon_pi1.soap.url = ${modified[4]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.settings.useSEPA.*/plugin.tx_egon_pi1.settings.useSEPA = ${modified[5]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.settings.useBaseProvider.*/plugin.tx_egon_pi1.settings.useBaseProvider = ${modified[6]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.settings.signatureAllowed.*/plugin.tx_egon_pi1.settings.signatureAllowed = ${modified[7]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.custom.companyName.*/plugin.tx_egon_pi1.custom.companyName = ${modified[8]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.custom.companyStreet.*/plugin.tx_egon_pi1.custom.companyStreet = ${modified[9]}/" ${typoscript}
sed -i "s/plugin.tx_egon_pi1.custom.companyCity.*/plugin.tx_egon_pi1.custom.companyCity = ${modified[10]}/" ${typoscript}
echo -e "${LIBLUE}Writing changes to Database now.. ${NF}\n"
pushConstantsDB
else
echo -e "${LIBLUE}Returning to main menu without any changes.. ${NF}"
sleep 6
fi
else
echo -e "${LIBLUE}Returning to main menu without any changes.. ${NF}"
sleep 6
fi

