Skip to content

Commit 78d71ee

Browse files
committed
Bugfix on input() function
1 parent 2c9fb65 commit 78d71ee

5 files changed

Lines changed: 68 additions & 31 deletions

File tree

lib/easybashgui.lib

Lines changed: 64 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#####################################
3636
#####################################
3737
#
38-
LIB_VERSION="13.0.1"
38+
LIB_VERSION="13.0.2"
3939
LIB_NAME="easybashgui.lib"
4040
LIB_URL="https://github.com/BashGui/easybashgui"
4141
LIB_AUTHOR="Vittorio Cagnetta"
@@ -6889,21 +6889,31 @@ if [ "${mode}" = "yad" ]
68896889
#############
68906890
scelta="$(eval $(local IFS=$'\t' && echo -e "${dialogo}\t--title\t\"${supertitle:-EasyBashGUI}: data input\"\t--form\t${stringa_yad}\t--separator\t\"\\\n\"\t${dimensione_finestra}\t2>\t/dev/null" ) )"
68916891
unset stringa_yad
6892-
printf -v scelta "%q" "${scelta}"
6893-
echo -e "${scelta}" 1> "${dir_tmp}/${file_tmp}"
6894-
#############
6895-
#
6896-
if [ $(fgrep "$(echo -e "${scelta}" | head -n 1 )" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -eq 0 ]
6897-
then
6898-
question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\nShould I continue the same ?" ; conferma="${?}"
6899-
if [ "${conferma}" -eq 0 ] #"Confermato"
6900-
then
6901-
:
6902-
elif [ "${conferma}" -eq 1 ] #"Non confermato"
6892+
#printf -v scelta "%q" "${scelta}"
6893+
#echo -e "${scelta}" 1> "${dir_tmp}/${file_tmp}"
6894+
: 1> "${dir_tmp}/${file_tmp}"
6895+
for (( volta=1 ; volta <= ${quanti_campi} ; volta++ ))
6896+
do
6897+
#
6898+
scelta_line="$(echo -e "${scelta}" | head -n ${volta} | tail -n 1 )"
6899+
#
6900+
[ ${#scelta_line} -gt 0 ] && printf -v scelta_line "%q" "${scelta_line}"
6901+
#
6902+
echo -e "${scelta_line}" 1>> "${dir_tmp}/${file_tmp}"
6903+
if [ $(fgrep "$(echo -e "${scelta_line}" | head -n 1 )" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -eq 0 ]
69036904
then
6904-
exit
6905+
question "Warning: could not write \"\${scelta_line}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\nShould I continue the same ?" ; conferma="${?}"
6906+
if [ "${conferma}" -eq 0 ] #"Confermato"
6907+
then
6908+
:
6909+
elif [ "${conferma}" -eq 1 ] #"Non confermato"
6910+
then
6911+
exit
6912+
fi
69056913
fi
6906-
fi
6914+
#
6915+
done
6916+
#############
69076917
#
69086918
exit_if_user_closes_window
69096919
#
@@ -7232,6 +7242,7 @@ elif [ "${mode}" = "Xdialog" ]
72327242
echo -ne "${args[${index}]}\t"
72337243
done)"
72347244
#
7245+
#############
72357246
if [ ${quanti_campi} -eq 1 ]
72367247
then
72377248
inputbox="--inputbox"
@@ -7249,6 +7260,19 @@ elif [ "${mode}" = "Xdialog" ]
72497260
#
72507261
local IFS=$' \t\n'
72517262
#
7263+
if [ $(fgrep "$(echo -e "${scelta}" | head -n 1 )" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -eq 0 ]
7264+
then
7265+
question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\n Continue ?" ; conferma="${?}"
7266+
if [ "${conferma}" -eq 0 ] #"Confermato"
7267+
then
7268+
:
7269+
elif [ "${conferma}" -eq 1 ] #"Non confermato"
7270+
then
7271+
exit
7272+
fi
7273+
#
7274+
fi #if [ "${scelta}" = "$(0< "${dir_tmp}/${file_tmp}" )" ]
7275+
#
72527276
elif [ ${quanti_campi} -gt 1 ]
72537277
then
72547278
inputbox="--${quanti_campi}inputsbox"
@@ -7257,25 +7281,37 @@ elif [ "${mode}" = "Xdialog" ]
72577281
#
72587282
#############
72597283
scelta=$( ${dialogo} --stdout --separator "\\n" --title "${supertitle:-EasyBashGUI}: data input" ${inputbox} "Please, write data ..." ${dimensione_finestra} ${parametri} 2> /dev/null | grep -v "${string_to_clean}" )
7260-
printf -v scelta "%q" "${scelta}"
7261-
echo -e "${scelta}" 1> "${dir_tmp}/${file_tmp}"
7284+
#printf -v scelta "%q" "${scelta}"
7285+
#echo -e "${scelta}" 1> "${dir_tmp}/${file_tmp}"
72627286
#############
72637287
#
72647288
local IFS=$' \t\n'
72657289
#
7290+
: 1> "${dir_tmp}/${file_tmp}"
7291+
for (( volta=1 ; volta <= ${quanti_campi} ; volta++ ))
7292+
do
7293+
#
7294+
scelta_line="$(echo -e "${scelta}" | head -n ${volta} | tail -n 1 )"
7295+
#
7296+
[ ${#scelta_line} -gt 0 ] && printf -v scelta_line "%q" "${scelta_line}"
7297+
#
7298+
echo -e "${scelta_line}" 1>> "${dir_tmp}/${file_tmp}"
7299+
if [ $(fgrep "$(echo -e "${scelta_line}" | head -n 1 )" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -eq 0 ]
7300+
then
7301+
question "Warning: could not write \"\${scelta_line}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\nShould I continue the same ?" ; conferma="${?}"
7302+
if [ "${conferma}" -eq 0 ] #"Confermato"
7303+
then
7304+
:
7305+
elif [ "${conferma}" -eq 1 ] #"Non confermato"
7306+
then
7307+
exit
7308+
fi
7309+
fi
7310+
#
7311+
done
7312+
#
72667313
fi #if [ ${quanti_campi} -eq 1 ]
7267-
#
7268-
if [ $(fgrep "$(echo -e "${scelta}" | head -n 1 )" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -eq 0 ]
7269-
then
7270-
question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\n Continue ?" ; conferma="${?}"
7271-
if [ "${conferma}" -eq 0 ] #"Confermato"
7272-
then
7273-
:
7274-
elif [ "${conferma}" -eq 1 ] #"Non confermato"
7275-
then
7276-
exit
7277-
fi
7278-
fi #if [ "${scelta}" = "$(0< "${dir_tmp}/${file_tmp}" )" ]
7314+
#############
72797315
#
72807316
exit_if_user_closes_window
72817317
#

makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#EBGlib=$(wildcard easybashgui_[0-9].[0-9].[0-9])
2-
VERSION=13.0.1
2+
VERSION=13.0.2
33

44
#cartelle di destinazione
55
DESTDIR ?= ""

src/easybashgui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
#
7777
#
7878
###################################################################
79-
MODULE_VERSION="13.0.1"
79+
MODULE_VERSION="13.0.2"
8080
MODULE_NAME="easybashgui"
8181
libexec_dir="/usr/lib/easybashgui"
8282
###################################################################

src/easybashgui-debug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
#
7777
#
7878
###################################################################
79-
MODULE_VERSION="13.0.1"
79+
MODULE_VERSION="13.0.2"
8080
MODULE_NAME="easybashgui-debug"
8181
###################################################################
8282
#

src/easydialog-legacy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ while getopts ":hvm:" option
114114
elif [ "${OPTARG}" = "k" ]; then export supermode="kdialog" && break ; \
115115
elif [ "${OPTARG}" = "z" ]; then export supermode="zenity" && break ; \
116116
elif [ "${OPTARG}" = "x" ]; then export supermode="Xdialog" && break ; \
117+
elif [ "${OPTARG}" = "x" ]; then export supermode="gum" && break ; \
117118
elif [ "${OPTARG}" = "d" ]; then export supermode="dialog" && break ; \
118119
elif [ "${OPTARG}" = "n" ]; then export supermode="none" && break ; \
119120
else usage ; \

0 commit comments

Comments
 (0)