penguins-eggs 9.3.20 → 9.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oclif.manifest.json +1 -1
- package/README.md +143 -80
- package/conf/derivatives.yaml +32 -31
- package/dist/classes/distro.js +10 -3
- package/dist/classes/pacman.js +3 -3
- package/dist/commands/adapt.js +6 -4
- package/dist/commands/analyze.js +2 -2
- package/dist/commands/calamares.js +9 -4
- package/dist/commands/config.js +7 -4
- package/dist/commands/cuckoo.js +4 -6
- package/dist/commands/dad.js +7 -2
- package/dist/commands/export/deb.js +7 -2
- package/dist/commands/export/iso.js +7 -2
- package/dist/commands/install.js +14 -16
- package/dist/commands/kill.js +4 -2
- package/dist/commands/mom.js +5 -2
- package/dist/commands/produce.js +15 -17
- package/dist/commands/status.js +6 -3
- package/dist/commands/syncfrom.js +6 -6
- package/dist/commands/syncto.js +5 -3
- package/dist/commands/tools/clean.js +4 -2
- package/dist/commands/tools/ppa.js +6 -2
- package/dist/commands/tools/skel.js +5 -6
- package/dist/commands/tools/stat.js +6 -1
- package/dist/commands/tools/yolk.js +4 -2
- package/dist/commands/update.js +4 -2
- package/dist/commands/wardrobe/get.js +8 -4
- package/dist/commands/wardrobe/list.js +8 -4
- package/dist/commands/wardrobe/show.js +9 -4
- package/dist/commands/wardrobe/wear.js +9 -4
- package/dist/lib/dependencies.js +7 -6
- package/package.json +3 -3
- package/scripts/README.md +120 -0
- package/scripts/includes/common.sh +59 -0
- package/scripts/includes/easybashgui +1695 -0
- package/scripts/includes/easybashgui-debug +146 -0
- package/scripts/includes/easybashgui.lib +8039 -0
- package/scripts/includes/easybashlib +550 -0
- package/scripts/includes/easydialog-legacy +163 -0
- package/scripts/mom.sh +56 -0
- /package/scripts/{mom-cli.sh → old-mom-cli.sh} +0 -0
|
@@ -0,0 +1,1695 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
#####################################
|
|
4
|
+
#####################################
|
|
5
|
+
#
|
|
6
|
+
# easybashgui "module"
|
|
7
|
+
#
|
|
8
|
+
# This file is intended to be packaged with scripts that use easybashgui.
|
|
9
|
+
#
|
|
10
|
+
# This file will try to source easybashgui_X.X.X.lib, or provide
|
|
11
|
+
# fallback functions, thus avoiding a hard dependency on easybashgui ".lib" file.
|
|
12
|
+
#
|
|
13
|
+
#########################
|
|
14
|
+
#
|
|
15
|
+
# Copyright (C) 2020 Vittorio Cagnetta
|
|
16
|
+
#
|
|
17
|
+
# Author: Vittorio Cagnetta <vaisarger@gmail.com>
|
|
18
|
+
# Author: Christian ? <https://launchpad.net/~cgat-1>
|
|
19
|
+
#
|
|
20
|
+
# This program is free software; you can redistribute it and/or modify
|
|
21
|
+
# it under the terms of the GNU General Public License as published by
|
|
22
|
+
# the Free Software Foundation; version 3 of the License.
|
|
23
|
+
#
|
|
24
|
+
# This program is distributed in the hope that it will be useful,
|
|
25
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
26
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
27
|
+
# GNU General Public License for more details.
|
|
28
|
+
#
|
|
29
|
+
# You should have received a copy of the GNU General Public License along with this program,
|
|
30
|
+
# called, in this distribution, "EasyBashGUI-license"; if not, write to the
|
|
31
|
+
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
32
|
+
#
|
|
33
|
+
#########################
|
|
34
|
+
#
|
|
35
|
+
# There are two easy methods to use easybashgui in your projects.
|
|
36
|
+
#
|
|
37
|
+
# The basic method introduces a hard dependency on easybashgui. This means
|
|
38
|
+
# easybashgui must be installed on the machine your script is running on,
|
|
39
|
+
# or your script will fail with an error. This method only requires to
|
|
40
|
+
# call "source easybashgui" (once) in your script to be able to use
|
|
41
|
+
# easybashgui functions if easybashgui is installed, but will make
|
|
42
|
+
# your script fail without it.
|
|
43
|
+
#
|
|
44
|
+
# The easybashincl method however allows your script to run
|
|
45
|
+
# without easybashgui installed, or even available:
|
|
46
|
+
#
|
|
47
|
+
# 1) Ship a copy of just the "easybashgui" file from the easybashgui
|
|
48
|
+
# package with your script's package.
|
|
49
|
+
# (in same directory as the calling script, or in an includes/ subdirectory)
|
|
50
|
+
# 2) Copy the "easybashincl code snippet" from the "easybashgui" file
|
|
51
|
+
# into your script.
|
|
52
|
+
# 3) Call "eb_incl easybashgui" from your script.
|
|
53
|
+
#
|
|
54
|
+
# If you also include the easybashgui.lib file in your package, and
|
|
55
|
+
# use the easybashincl method, your script will also work with any supported dialog
|
|
56
|
+
# frontend without requiring a separate easybashgui download and installation
|
|
57
|
+
# on the target system.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### INCLUDABLE EASYBASH MODULES ###
|
|
61
|
+
# The easybashincl code snippet below allows easy inclusion of
|
|
62
|
+
# bash scripts from other bash scripts.
|
|
63
|
+
#
|
|
64
|
+
# Unlike the bash builtin "source" (or "."), it does not require the
|
|
65
|
+
# file to be installed in your $PATH.
|
|
66
|
+
#
|
|
67
|
+
# If the requested module (bash script file) is not in the $PATH,
|
|
68
|
+
# the "eb_incl" function will look for it in these places:
|
|
69
|
+
#
|
|
70
|
+
# * same directory as the calling script
|
|
71
|
+
# * includes/ subdirectory
|
|
72
|
+
# * ${SHELL_LIBRARY_PATH}
|
|
73
|
+
#
|
|
74
|
+
# Improvement thanks to Stefano Borini's answer at
|
|
75
|
+
# http://stackoverflow.com/questions/78497/design-patterns-or-best-practices-for-shell-scripts
|
|
76
|
+
#
|
|
77
|
+
#
|
|
78
|
+
###################################################################
|
|
79
|
+
MODULE_VERSION="12.0.4"
|
|
80
|
+
MODULE_NAME="easybashgui"
|
|
81
|
+
libexec_dir="/usr/lib/easybashgui"
|
|
82
|
+
###################################################################
|
|
83
|
+
#
|
|
84
|
+
clean_temp()
|
|
85
|
+
{
|
|
86
|
+
local FUNCT_NAME="clean_temp"
|
|
87
|
+
local IFS=$' \t\n'
|
|
88
|
+
#
|
|
89
|
+
if [ -f "${dir_tmp}/${file_tmp}" ] 2> /dev/null
|
|
90
|
+
then
|
|
91
|
+
rm -f "${dir_tmp}/${file_tmp}" 2> /dev/null
|
|
92
|
+
fi
|
|
93
|
+
#
|
|
94
|
+
if [ -f "${dir_tmp}/${file_ignore}" ] 2> /dev/null
|
|
95
|
+
then
|
|
96
|
+
rm -f "${dir_tmp}/${file_ignore}" 2> /dev/null
|
|
97
|
+
fi
|
|
98
|
+
#
|
|
99
|
+
}
|
|
100
|
+
#
|
|
101
|
+
###################################################################
|
|
102
|
+
# Every easybash module should prevent repeated inclusion by
|
|
103
|
+
# starting with an if-clause similar to the following:
|
|
104
|
+
# ( With its proper module-name in the
|
|
105
|
+
# "eb_incl_<module-name>__imported" variable. )
|
|
106
|
+
#
|
|
107
|
+
# avoid inclusion if "easybashgui-debug" has been sourced...
|
|
108
|
+
if [ "${eb_incl_easybashgui_debug__imported+defined}" = "defined" ]
|
|
109
|
+
then
|
|
110
|
+
# "easybashgui-debug" was sourced!...
|
|
111
|
+
[ "${target:-unset}" = "unset" ] && declare target=""
|
|
112
|
+
if [ "${target}" = "easybashgui-debug" ]
|
|
113
|
+
then
|
|
114
|
+
# "easybashgui" has been sourced by "easybashgui-debug"...
|
|
115
|
+
ebg_check="NO"
|
|
116
|
+
unset target
|
|
117
|
+
#
|
|
118
|
+
else
|
|
119
|
+
# "easybashgui" has been sourced manually or through a script...
|
|
120
|
+
ebg_check="YES"
|
|
121
|
+
#
|
|
122
|
+
fi
|
|
123
|
+
#
|
|
124
|
+
else
|
|
125
|
+
# "easybashgui-debug" was not sourced!...
|
|
126
|
+
ebg_check="YES"
|
|
127
|
+
#
|
|
128
|
+
fi
|
|
129
|
+
#
|
|
130
|
+
##
|
|
131
|
+
#
|
|
132
|
+
if [ "${ebg_check}" = "YES" ]
|
|
133
|
+
then
|
|
134
|
+
#
|
|
135
|
+
# avoid "easybashgui" repeated inclusion
|
|
136
|
+
if [ "${eb_incl_easybashgui__imported+defined}" = "defined" ]
|
|
137
|
+
then
|
|
138
|
+
#
|
|
139
|
+
[ "${supermode:-unset}" = "unset" ] && declare supermode=""
|
|
140
|
+
#
|
|
141
|
+
if [ ${#supermode} -eq 0 ]
|
|
142
|
+
then
|
|
143
|
+
# Prevent repeated inclusion *only if* ${supermode} is not set ...
|
|
144
|
+
echo "${MODULE_NAME}: ERR: easybashgui not sourced (already sourced)! -supermode not set- ."
|
|
145
|
+
return 0
|
|
146
|
+
fi
|
|
147
|
+
#
|
|
148
|
+
if [ "${supermode}" = "${mode}" ]
|
|
149
|
+
then
|
|
150
|
+
# Prevent repeated inclusion *only if* ${supermode} = ${mode} ...
|
|
151
|
+
echo "${MODULE_NAME}: ERR: easybashgui not sourced (already sourced) -supermode is not different from mode- ."
|
|
152
|
+
return 0
|
|
153
|
+
fi
|
|
154
|
+
#
|
|
155
|
+
fi
|
|
156
|
+
#
|
|
157
|
+
#echo -e "...easybashgui sourcing..."
|
|
158
|
+
#
|
|
159
|
+
#eb_incl_easybashgui__imported=1
|
|
160
|
+
eb_incl_easybashgui__imported=please_prevent_next_time
|
|
161
|
+
#
|
|
162
|
+
export easybashgui_debug_mode=NO
|
|
163
|
+
#
|
|
164
|
+
fi
|
|
165
|
+
#
|
|
166
|
+
###################################################################
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
##################################################################################
|
|
172
|
+
##################################################################################
|
|
173
|
+
##################################################################################
|
|
174
|
+
##################################################################################
|
|
175
|
+
#
|
|
176
|
+
# The master copy of the "easybashincl code snippet" is
|
|
177
|
+
# being maintained in easybashgui (as it loads easybashlib).
|
|
178
|
+
#
|
|
179
|
+
##################################################################################
|
|
180
|
+
##################################################################################
|
|
181
|
+
################## BEGIN easybashincl code snippet ###############################
|
|
182
|
+
##################################################################################
|
|
183
|
+
#
|
|
184
|
+
|
|
185
|
+
# avoid repeated definitions
|
|
186
|
+
function eb_incl_loading_required()
|
|
187
|
+
{
|
|
188
|
+
local this_eb_incl_version="4"
|
|
189
|
+
|
|
190
|
+
if [ "${eb_incl_snippet__version:-0}" = "0" ] \
|
|
191
|
+
|| [ "${this_eb_incl_version}" -gt "${eb_incl_snippet__version}" ]
|
|
192
|
+
then
|
|
193
|
+
declare eb_incl_snippet__version="${this_eb_incl_version}"
|
|
194
|
+
return 0
|
|
195
|
+
else
|
|
196
|
+
return 1
|
|
197
|
+
fi
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
declare eb_current_process_path="$(echo "${0}" | sed s\#'^-'#''# )"
|
|
202
|
+
if eb_incl_loading_required
|
|
203
|
+
then
|
|
204
|
+
|
|
205
|
+
declare eb_runtime_invoke_path="${eb_current_process_path}"
|
|
206
|
+
declare eb_runtime_invoke_name="$(basename "${eb_current_process_path}" )"
|
|
207
|
+
declare eb_runtime_abs_invoke_dir
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
function eb_absolute_path()
|
|
211
|
+
# Returns the absolute path of the given path (or of the running script if no path is specified).
|
|
212
|
+
{
|
|
213
|
+
if [ "$#" = "0" ]
|
|
214
|
+
then
|
|
215
|
+
local given_path="$0"
|
|
216
|
+
else
|
|
217
|
+
local given_path="$1"
|
|
218
|
+
fi
|
|
219
|
+
|
|
220
|
+
# if path is already absolute
|
|
221
|
+
if [ "x${given_path:0:1}" = 'x/' ]
|
|
222
|
+
then
|
|
223
|
+
echo $(dirname "$given_path")
|
|
224
|
+
else
|
|
225
|
+
echo $(dirname "$(pwd)/$given_path")
|
|
226
|
+
fi
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
eb_runtime_abs_invoke_dir=$(eb_absolute_path)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
# eb_incl() lets you include files into your main script (modularization)
|
|
234
|
+
# it searches for file in system, same dir, and $SHELL_LIBRARY_PATH
|
|
235
|
+
#
|
|
236
|
+
function eb_incl() {
|
|
237
|
+
local module=$1
|
|
238
|
+
|
|
239
|
+
if [ "${module:-unspecified}" = "unspecified" ]
|
|
240
|
+
then
|
|
241
|
+
echo "$eb_runtime_invoke_name: eb_incl: No module specified." 1>&2
|
|
242
|
+
return 1
|
|
243
|
+
fi
|
|
244
|
+
|
|
245
|
+
if [ "x${eb_runtime_abs_invoke_dir:-notset}" == "xnotset" ]
|
|
246
|
+
then
|
|
247
|
+
echo "$eb_runtime_invoke_name: eb_incl: Error, eb_runtime_abs_invoke_dir not set."
|
|
248
|
+
exit 1
|
|
249
|
+
fi
|
|
250
|
+
|
|
251
|
+
if [ "x$eb_runtime_abs_invoke_dir" == "x" ]
|
|
252
|
+
then
|
|
253
|
+
echo "$eb_runtime_invoke_name: eb_incl: Error, eb_runtime_abs_invoke_dir is empty."
|
|
254
|
+
exit 1
|
|
255
|
+
fi
|
|
256
|
+
|
|
257
|
+
# if installed in system's PATH
|
|
258
|
+
if type "$module" &>/dev/null
|
|
259
|
+
then
|
|
260
|
+
source "$module"
|
|
261
|
+
return 0
|
|
262
|
+
|
|
263
|
+
# if in same dir
|
|
264
|
+
elif [ -e "$eb_runtime_abs_invoke_dir/$module" ]
|
|
265
|
+
then
|
|
266
|
+
source "$eb_runtime_abs_invoke_dir/$module"
|
|
267
|
+
return 0
|
|
268
|
+
|
|
269
|
+
# if in includes/ subdir
|
|
270
|
+
elif [ -e "$eb_runtime_abs_invoke_dir/includes" ] \
|
|
271
|
+
&& [ -e "$eb_runtime_abs_invoke_dir/includes/$module" ]
|
|
272
|
+
then
|
|
273
|
+
source "$eb_runtime_abs_invoke_dir/includes/$module"
|
|
274
|
+
return 0
|
|
275
|
+
|
|
276
|
+
# if in "libexec_dir"
|
|
277
|
+
elif [ -e "$libexec_dir/$module" ]
|
|
278
|
+
then
|
|
279
|
+
source "$libexec_dir/$module"
|
|
280
|
+
return 0
|
|
281
|
+
|
|
282
|
+
# if lib path is defined
|
|
283
|
+
elif [ "${SHELL_LIBRARY_PATH:-unset}" != "unset" ]
|
|
284
|
+
then
|
|
285
|
+
local saved_IFS="$IFS"
|
|
286
|
+
IFS=':'
|
|
287
|
+
for path in $SHELL_LIBRARY_PATH
|
|
288
|
+
do
|
|
289
|
+
if [ -e "$path/$module" ]
|
|
290
|
+
then
|
|
291
|
+
source "$path/$module"
|
|
292
|
+
return 0
|
|
293
|
+
fi
|
|
294
|
+
done
|
|
295
|
+
IFS="$saved_IFS"
|
|
296
|
+
|
|
297
|
+
fi
|
|
298
|
+
echo -e "$eb_runtime_invoke_name: eb_incl: Could not find requested module \"$module\" in \$PATH, $eb_runtime_abs_invoke_dir, an includes/ subdirectory, or \$SHELL_LIBRARY_PATH." 1>&2 && return 1
|
|
299
|
+
#exit 1
|
|
300
|
+
}
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
################## END easybashincl code snippet #################################
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
function load_easybashgui_lib()
|
|
312
|
+
{
|
|
313
|
+
# first, try to include easybashlib to enable registration of an on_exit hook
|
|
314
|
+
if eb_incl easybashlib
|
|
315
|
+
then
|
|
316
|
+
# include it without safety settings, until fixed
|
|
317
|
+
if eb_skip_exit_on_err_or_unset eb_incl easybashgui.lib
|
|
318
|
+
then
|
|
319
|
+
# register easybashgui cleanup
|
|
320
|
+
#
|
|
321
|
+
ebg_add_on_exit clean_temp
|
|
322
|
+
return 0 # OK!
|
|
323
|
+
else
|
|
324
|
+
return 1
|
|
325
|
+
fi
|
|
326
|
+
#
|
|
327
|
+
elif eb_incl easybashgui.lib
|
|
328
|
+
then
|
|
329
|
+
echo "$eb_runtime_invoke_name: easybashgui: Could not load easybashlib, calling script needs to call \"clean_temp\" manually." 1>&2
|
|
330
|
+
return 0 # OK!
|
|
331
|
+
#
|
|
332
|
+
else
|
|
333
|
+
echo -e "$eb_runtime_invoke_name: easybashgui: Could not load \"easybashgui.lib\" (download tarball at URL: https://github.com/BashGui/easybashgui/tags)." 1>&2
|
|
334
|
+
return 1 # DOH!
|
|
335
|
+
fi
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
if load_easybashgui_lib
|
|
342
|
+
then
|
|
343
|
+
# "load_easybashgui_lib()" returned "0"...
|
|
344
|
+
: eb_gui_fallback # could be "false", or not defined... let's go to next "if"
|
|
345
|
+
else
|
|
346
|
+
# "load_easybashgui_lib()" returned "1"...
|
|
347
|
+
eb_gui_fallback="true"
|
|
348
|
+
fi
|
|
349
|
+
|
|
350
|
+
# =>
|
|
351
|
+
|
|
352
|
+
if [ "${eb_gui_fallback:-undefined}" != "true" ]
|
|
353
|
+
then
|
|
354
|
+
return 0
|
|
355
|
+
#
|
|
356
|
+
elif [ "${eb_gui_fallback}" = "true" ]
|
|
357
|
+
then
|
|
358
|
+
#
|
|
359
|
+
echo -e "${MODULE_NAME}: Initializing fallback mode." 1>&2
|
|
360
|
+
set +o nounset +o errexit
|
|
361
|
+
shopt -u extdebug
|
|
362
|
+
#echo "easybashgui_debug_mode OFF"
|
|
363
|
+
|
|
364
|
+
#
|
|
365
|
+
##
|
|
366
|
+
#
|
|
367
|
+
export mode="none"
|
|
368
|
+
#
|
|
369
|
+
# define temp files...
|
|
370
|
+
default_tmp="${HOME}/tmp"
|
|
371
|
+
if [ -d "${default_tmp}" ]
|
|
372
|
+
then
|
|
373
|
+
dir_tmp="${default_tmp}"
|
|
374
|
+
else
|
|
375
|
+
dir_tmp="/tmp"
|
|
376
|
+
fi
|
|
377
|
+
[ ! -d "${dir_tmp}" -o ! -w "${dir_tmp}" ] && mkdir "${default_tmp}" && dir_tmp="${default_tmp}"
|
|
378
|
+
: dir_tmp
|
|
379
|
+
#
|
|
380
|
+
if [ -f "${dir_tmp}/${file_tmp}" ]
|
|
381
|
+
then
|
|
382
|
+
: 1> "${dir_tmp}/${file_tmp}"
|
|
383
|
+
: 1> "${dir_tmp}/${file_ignore}"
|
|
384
|
+
else
|
|
385
|
+
cd "${dir_tmp}"
|
|
386
|
+
export file_tmp="$(mktemp "XXXXXXXXXXXXXXXXXXXX" )"
|
|
387
|
+
export file_ignore="$(mktemp "XXXXXXXXXXXXXXXXXXXX" )"
|
|
388
|
+
cd - 1>/dev/null
|
|
389
|
+
fi
|
|
390
|
+
: file_tmp
|
|
391
|
+
#
|
|
392
|
+
##
|
|
393
|
+
#
|
|
394
|
+
# define fall back functions
|
|
395
|
+
frame="----------------------------"
|
|
396
|
+
#
|
|
397
|
+
clean_temp()
|
|
398
|
+
{
|
|
399
|
+
local FUNCT_NAME="clean_temp"
|
|
400
|
+
local IFS=$' \t\n'
|
|
401
|
+
#
|
|
402
|
+
if [ -f "${dir_tmp}/${file_tmp}" ] 2> /dev/null
|
|
403
|
+
then
|
|
404
|
+
rm -f "${dir_tmp}/${file_tmp}" 2> /dev/null
|
|
405
|
+
fi
|
|
406
|
+
#
|
|
407
|
+
if [ -f "${dir_tmp}/${file_ignore}" ] 2> /dev/null
|
|
408
|
+
then
|
|
409
|
+
rm -f "${dir_tmp}/${file_ignore}" 2> /dev/null
|
|
410
|
+
fi
|
|
411
|
+
#
|
|
412
|
+
}
|
|
413
|
+
#
|
|
414
|
+
##
|
|
415
|
+
#
|
|
416
|
+
arrotonda()
|
|
417
|
+
{
|
|
418
|
+
local FUNCT_NAME="arrotonda"
|
|
419
|
+
local IFS=$' \t\n'
|
|
420
|
+
#
|
|
421
|
+
float="${1}"
|
|
422
|
+
#
|
|
423
|
+
float__integer_part=$(echo "${float}" | cut -d '.' -f 1 ) ; [ ${#float__integer_part} -eq 0 ] && float__integer_part=0
|
|
424
|
+
float__decimal_part=$(echo "${float}" | cut -d '.' -f 2 )
|
|
425
|
+
# =>
|
|
426
|
+
[ ${float__decimal_part} -le 50 ] && \
|
|
427
|
+
arrotondato=${float__integer_part} || \
|
|
428
|
+
arrotondato=$(( ${float__integer_part} + 1 ))
|
|
429
|
+
#
|
|
430
|
+
echo "${arrotondato}"
|
|
431
|
+
#
|
|
432
|
+
}
|
|
433
|
+
#
|
|
434
|
+
##
|
|
435
|
+
#
|
|
436
|
+
if_arg_is_an_empty_variable_then_exit()
|
|
437
|
+
{
|
|
438
|
+
local FUNCT_NAME="if_arg_is_an_empty_variable_then_exit"
|
|
439
|
+
local IFS=$' \t\n'
|
|
440
|
+
#
|
|
441
|
+
var_da_controllare="${1}"
|
|
442
|
+
if [ $(echo -n "${!var_da_controllare}" | wc -c ) -eq 0 ]
|
|
443
|
+
then
|
|
444
|
+
#
|
|
445
|
+
clean_temp
|
|
446
|
+
exit
|
|
447
|
+
fi
|
|
448
|
+
}
|
|
449
|
+
#
|
|
450
|
+
##
|
|
451
|
+
#
|
|
452
|
+
# question()
|
|
453
|
+
question()
|
|
454
|
+
{
|
|
455
|
+
local FUNCT_NAME="question"
|
|
456
|
+
local IFS=$' \t\n'
|
|
457
|
+
#
|
|
458
|
+
#########################################
|
|
459
|
+
# Begin check for user custom geometry...
|
|
460
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
461
|
+
do
|
|
462
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
463
|
+
then
|
|
464
|
+
echo "width"
|
|
465
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
466
|
+
then
|
|
467
|
+
echo "height"
|
|
468
|
+
fi )"
|
|
469
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
470
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
471
|
+
done
|
|
472
|
+
# End check for user custom geometry...
|
|
473
|
+
#########################################
|
|
474
|
+
#
|
|
475
|
+
testo="${@}"
|
|
476
|
+
#
|
|
477
|
+
#########################################
|
|
478
|
+
echo "${frame}"
|
|
479
|
+
echo "$(basename "${eb_current_process_path}" ): please confirm"
|
|
480
|
+
echo "${frame}"
|
|
481
|
+
echo -e "\n${testo}\n"
|
|
482
|
+
select okcancel in "Ok" "Cancel"
|
|
483
|
+
do
|
|
484
|
+
if [ ${#okcancel} -eq 0 ]
|
|
485
|
+
then
|
|
486
|
+
echo -e "\n\nErr.: Incorrect selection, please select only number."
|
|
487
|
+
echo -e "\n${testo}\n"
|
|
488
|
+
echo "1) Ok"
|
|
489
|
+
echo "2) Cancel"
|
|
490
|
+
else
|
|
491
|
+
break
|
|
492
|
+
fi
|
|
493
|
+
done
|
|
494
|
+
if [ "${okcancel}" = "Ok" ]
|
|
495
|
+
then
|
|
496
|
+
exit_code="0"
|
|
497
|
+
elif [ "${okcancel}" = "Cancel" ]
|
|
498
|
+
then
|
|
499
|
+
exit_code="1"
|
|
500
|
+
fi
|
|
501
|
+
echo -e "${frame}\n\n"
|
|
502
|
+
echo
|
|
503
|
+
#########################################
|
|
504
|
+
#
|
|
505
|
+
echo "${exit_code}" 1>&2
|
|
506
|
+
return "${exit_code}"
|
|
507
|
+
#
|
|
508
|
+
}
|
|
509
|
+
# question()
|
|
510
|
+
#
|
|
511
|
+
##
|
|
512
|
+
#
|
|
513
|
+
# message()
|
|
514
|
+
message()
|
|
515
|
+
{
|
|
516
|
+
local FUNCT_NAME="message"
|
|
517
|
+
local IFS=$' \t\n'
|
|
518
|
+
#
|
|
519
|
+
#########################################
|
|
520
|
+
# Begin check for user custom geometry...
|
|
521
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
522
|
+
do
|
|
523
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
524
|
+
then
|
|
525
|
+
echo "width"
|
|
526
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
527
|
+
then
|
|
528
|
+
echo "height"
|
|
529
|
+
fi )"
|
|
530
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
531
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
532
|
+
done
|
|
533
|
+
# End check for user custom geometry...
|
|
534
|
+
#########################################
|
|
535
|
+
#
|
|
536
|
+
testo="${@}"
|
|
537
|
+
#
|
|
538
|
+
#########################################
|
|
539
|
+
echo -e "\n\n\n${frame}"
|
|
540
|
+
echo "$(basename "${eb_current_process_path}" ): message"
|
|
541
|
+
echo "${frame}"
|
|
542
|
+
echo -e "\n${testo}\n"
|
|
543
|
+
select okcancel in "Ok"
|
|
544
|
+
do
|
|
545
|
+
if [ ${#okcancel} -eq 0 ]
|
|
546
|
+
then
|
|
547
|
+
echo -e "\n\nErr.: Incorrect selection, please select only number."
|
|
548
|
+
echo -e "\n${testo}\n"
|
|
549
|
+
echo "1) Ok"
|
|
550
|
+
else
|
|
551
|
+
break
|
|
552
|
+
fi
|
|
553
|
+
done
|
|
554
|
+
#
|
|
555
|
+
echo -e "${frame}\n"
|
|
556
|
+
echo
|
|
557
|
+
#########################################
|
|
558
|
+
#
|
|
559
|
+
}
|
|
560
|
+
# message()
|
|
561
|
+
#
|
|
562
|
+
##
|
|
563
|
+
#
|
|
564
|
+
# alert_message()
|
|
565
|
+
alert_message()
|
|
566
|
+
{
|
|
567
|
+
local FUNCT_NAME="alert_message"
|
|
568
|
+
local IFS=$' \t\n'
|
|
569
|
+
#
|
|
570
|
+
#########################################
|
|
571
|
+
# Begin check for user custom geometry...
|
|
572
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
573
|
+
do
|
|
574
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
575
|
+
then
|
|
576
|
+
echo "width"
|
|
577
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
578
|
+
then
|
|
579
|
+
echo "height"
|
|
580
|
+
fi )"
|
|
581
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
582
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
583
|
+
done
|
|
584
|
+
# End check for user custom geometry...
|
|
585
|
+
#########################################
|
|
586
|
+
#
|
|
587
|
+
testo="${@}"
|
|
588
|
+
#
|
|
589
|
+
#########################################
|
|
590
|
+
echo -e "\n\n\n${frame}"
|
|
591
|
+
echo "$(basename "${eb_current_process_path}" ): alert message"
|
|
592
|
+
echo "${frame}"
|
|
593
|
+
echo -e "\n:-(\n${testo}\n"
|
|
594
|
+
select okcancel in "Ok"
|
|
595
|
+
do
|
|
596
|
+
if [ ${#okcancel} -eq 0 ]
|
|
597
|
+
then
|
|
598
|
+
echo -e "\n\nErr.: Incorrect selection, please select only number."
|
|
599
|
+
echo -e "\n${testo}\n"
|
|
600
|
+
echo "1) Ok"
|
|
601
|
+
else
|
|
602
|
+
break
|
|
603
|
+
fi
|
|
604
|
+
done
|
|
605
|
+
#
|
|
606
|
+
echo -e "${frame}\n"
|
|
607
|
+
echo
|
|
608
|
+
#########################################
|
|
609
|
+
#
|
|
610
|
+
}
|
|
611
|
+
# alert_message()
|
|
612
|
+
#
|
|
613
|
+
##
|
|
614
|
+
#
|
|
615
|
+
# ok_message()
|
|
616
|
+
ok_message()
|
|
617
|
+
{
|
|
618
|
+
local FUNCT_NAME="ok_message"
|
|
619
|
+
local IFS=$' \t\n'
|
|
620
|
+
#
|
|
621
|
+
#########################################
|
|
622
|
+
# Begin check for user custom geometry...
|
|
623
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
624
|
+
do
|
|
625
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
626
|
+
then
|
|
627
|
+
echo "width"
|
|
628
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
629
|
+
then
|
|
630
|
+
echo "height"
|
|
631
|
+
fi )"
|
|
632
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
633
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
634
|
+
done
|
|
635
|
+
# End check for user custom geometry...
|
|
636
|
+
#########################################
|
|
637
|
+
#
|
|
638
|
+
testo="${@}"
|
|
639
|
+
#
|
|
640
|
+
#########################################
|
|
641
|
+
echo -e "\n\n\n${frame}"
|
|
642
|
+
echo "$(basename "${eb_current_process_path}" ): ok message"
|
|
643
|
+
echo "${frame}"
|
|
644
|
+
echo -e "\n:-)\n${testo}\n"
|
|
645
|
+
select okcancel in "Ok"
|
|
646
|
+
do
|
|
647
|
+
if [ ${#okcancel} -eq 0 ]
|
|
648
|
+
then
|
|
649
|
+
echo -e "\n\nErr.: Incorrect selection, please select only number."
|
|
650
|
+
echo -e "\n${testo}\n"
|
|
651
|
+
echo "1) Ok"
|
|
652
|
+
else
|
|
653
|
+
break
|
|
654
|
+
fi
|
|
655
|
+
done
|
|
656
|
+
#
|
|
657
|
+
echo -e "${frame}\n"
|
|
658
|
+
echo
|
|
659
|
+
#########################################
|
|
660
|
+
#
|
|
661
|
+
}
|
|
662
|
+
# ok_message()
|
|
663
|
+
#
|
|
664
|
+
##
|
|
665
|
+
#
|
|
666
|
+
# notify_message()
|
|
667
|
+
notify_message()
|
|
668
|
+
{
|
|
669
|
+
local FUNCT_NAME="notify_message"
|
|
670
|
+
local IFS=$' \t\n'
|
|
671
|
+
#
|
|
672
|
+
#########################################
|
|
673
|
+
# Begin check for user custom geometry...
|
|
674
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
675
|
+
do
|
|
676
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
677
|
+
then
|
|
678
|
+
echo "width"
|
|
679
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
680
|
+
then
|
|
681
|
+
echo "height"
|
|
682
|
+
fi )"
|
|
683
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
684
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
685
|
+
done
|
|
686
|
+
# End check for user custom geometry...
|
|
687
|
+
#########################################
|
|
688
|
+
#
|
|
689
|
+
num_secondi=4
|
|
690
|
+
testo="############################\n############################\n\n $(echo -e "${@}" )\n\n############################\n############################"
|
|
691
|
+
#
|
|
692
|
+
#########################################
|
|
693
|
+
echo -e "\n\n\n${frame}"
|
|
694
|
+
echo "$(basename "${eb_current_process_path}" ): notification"
|
|
695
|
+
echo "${frame}"
|
|
696
|
+
echo -e "\n${testo}\n"
|
|
697
|
+
#
|
|
698
|
+
sleep ${num_secondi}
|
|
699
|
+
#
|
|
700
|
+
echo -e "${frame}\n"
|
|
701
|
+
echo
|
|
702
|
+
#########################################
|
|
703
|
+
#
|
|
704
|
+
}
|
|
705
|
+
# notify_message()
|
|
706
|
+
#
|
|
707
|
+
##
|
|
708
|
+
#
|
|
709
|
+
# text()
|
|
710
|
+
text()
|
|
711
|
+
{
|
|
712
|
+
local FUNCT_NAME="text"
|
|
713
|
+
local IFS=$' \t\n'
|
|
714
|
+
local editable="--editable"
|
|
715
|
+
local window_title="editing text"
|
|
716
|
+
#
|
|
717
|
+
#########################################
|
|
718
|
+
# Begin check for text options...
|
|
719
|
+
while getopts ":w:h:F" function_option
|
|
720
|
+
do
|
|
721
|
+
case ${function_option} in
|
|
722
|
+
#
|
|
723
|
+
w ) : ;;
|
|
724
|
+
h ) : ;;
|
|
725
|
+
F ) editable="" ; window_title="text" ; F_param_number=$(($OPTIND - 1)) ;;
|
|
726
|
+
#
|
|
727
|
+
esac
|
|
728
|
+
done
|
|
729
|
+
#
|
|
730
|
+
if [ ${#editable} -eq 0 ]
|
|
731
|
+
then
|
|
732
|
+
array_parameters=( $@ )
|
|
733
|
+
F_param_array_number=$(( ${F_param_number} - 1 ))
|
|
734
|
+
#echo "devo eliminare array_parameters[${F_param_array_number}]: ${array_parameters[${F_param_array_number}]} ..." 2>/dev/null
|
|
735
|
+
unset array_parameters[${F_param_array_number}]
|
|
736
|
+
#echo "ora i parametri sono: \"${array_parameters[@]}\" ..." 2>/dev/null
|
|
737
|
+
set -- "${array_parameters[@]}"
|
|
738
|
+
fi
|
|
739
|
+
# End check for text options...
|
|
740
|
+
#########################################
|
|
741
|
+
# Begin check for user custom geometry...
|
|
742
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
743
|
+
do
|
|
744
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
745
|
+
then
|
|
746
|
+
echo "width"
|
|
747
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
748
|
+
then
|
|
749
|
+
echo "height"
|
|
750
|
+
fi )"
|
|
751
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
752
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
753
|
+
done
|
|
754
|
+
# End check for user custom geometry...
|
|
755
|
+
#########################################
|
|
756
|
+
#
|
|
757
|
+
file_input="${dir_tmp}/${file_ignore}"
|
|
758
|
+
#
|
|
759
|
+
cat - 1> "${file_input}"
|
|
760
|
+
#
|
|
761
|
+
#########################################
|
|
762
|
+
echo -e "\n\n\n${frame}"
|
|
763
|
+
echo "$(basename "${eb_current_process_path}" ): ${window_title}"
|
|
764
|
+
echo "${frame}"
|
|
765
|
+
#
|
|
766
|
+
if [ ${#editable} -gt 0 ]
|
|
767
|
+
then
|
|
768
|
+
less -o "${dir_tmp}/${file_tmp}" -X -f -P "Q) Ok (Press \"Q\" to continue, \"V\" to edit)" "${file_input}"
|
|
769
|
+
elif [ ${#editable} -eq 0 ]
|
|
770
|
+
then
|
|
771
|
+
less -X -f -P "Q) Ok (Press \"Q\" to continue)" 0< "${file_input}"
|
|
772
|
+
fi
|
|
773
|
+
#
|
|
774
|
+
echo -e "${frame}\n"
|
|
775
|
+
echo
|
|
776
|
+
#########################################
|
|
777
|
+
#
|
|
778
|
+
}
|
|
779
|
+
# text()
|
|
780
|
+
#
|
|
781
|
+
##
|
|
782
|
+
#
|
|
783
|
+
# wait_seconds()
|
|
784
|
+
wait_seconds()
|
|
785
|
+
{
|
|
786
|
+
local FUNCT_NAME="wait_seconds"
|
|
787
|
+
local IFS=$' \t\n'
|
|
788
|
+
#
|
|
789
|
+
#########################################
|
|
790
|
+
# Begin check for user custom geometry...
|
|
791
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
792
|
+
do
|
|
793
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
794
|
+
then
|
|
795
|
+
echo "width"
|
|
796
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
797
|
+
then
|
|
798
|
+
echo "height"
|
|
799
|
+
fi )"
|
|
800
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
801
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
802
|
+
done
|
|
803
|
+
# End check for user custom geometry...
|
|
804
|
+
#########################################
|
|
805
|
+
#
|
|
806
|
+
num_secondi=${1}
|
|
807
|
+
testo="############################\n############################\n\n\tPlease wait...\n\n############################\n############################"
|
|
808
|
+
#
|
|
809
|
+
#########################################
|
|
810
|
+
echo -e "\n\n\n${frame}"
|
|
811
|
+
echo "$(basename "${eb_current_process_path}" ): please wait"
|
|
812
|
+
echo "${frame}"
|
|
813
|
+
echo -e "\n${testo}\n"
|
|
814
|
+
#
|
|
815
|
+
sleep ${num_secondi}
|
|
816
|
+
#
|
|
817
|
+
echo -e "${frame}\n"
|
|
818
|
+
echo
|
|
819
|
+
#########################################
|
|
820
|
+
#
|
|
821
|
+
}
|
|
822
|
+
# wait_seconds()
|
|
823
|
+
#
|
|
824
|
+
##
|
|
825
|
+
#
|
|
826
|
+
# wait_for()
|
|
827
|
+
wait_for()
|
|
828
|
+
{
|
|
829
|
+
local FUNCT_NAME="wait_for"
|
|
830
|
+
local IFS=$' \t\n'
|
|
831
|
+
#
|
|
832
|
+
#########################################
|
|
833
|
+
# Begin check for user custom geometry...
|
|
834
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
835
|
+
do
|
|
836
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
837
|
+
then
|
|
838
|
+
echo "width"
|
|
839
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
840
|
+
then
|
|
841
|
+
echo "height"
|
|
842
|
+
fi )"
|
|
843
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
844
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
845
|
+
done
|
|
846
|
+
# End check for user custom geometry...
|
|
847
|
+
#########################################
|
|
848
|
+
#
|
|
849
|
+
num_secondi=1972
|
|
850
|
+
testo="############################\n############################\n\n\t$(echo -e "${@}" )\n\n############################\n############################"
|
|
851
|
+
#
|
|
852
|
+
#########################################
|
|
853
|
+
echo -e "\n\n\n${frame}"
|
|
854
|
+
echo "$(basename "${eb_current_process_path}" ): please wait"
|
|
855
|
+
echo "${frame}"
|
|
856
|
+
echo -e "\n${testo}\n"
|
|
857
|
+
#
|
|
858
|
+
sleep "${num_secondi}" &
|
|
859
|
+
#
|
|
860
|
+
export wait_for__PID="${!}"
|
|
861
|
+
#
|
|
862
|
+
echo -e "${frame}\n"
|
|
863
|
+
echo
|
|
864
|
+
#########################################
|
|
865
|
+
#
|
|
866
|
+
}
|
|
867
|
+
# wait_for()
|
|
868
|
+
#
|
|
869
|
+
##
|
|
870
|
+
#
|
|
871
|
+
terminate_wait_for()
|
|
872
|
+
{
|
|
873
|
+
local FUNCT_NAME="terminate_wait_for"
|
|
874
|
+
local IFS=$' \t\n'
|
|
875
|
+
#
|
|
876
|
+
[ ${#} -gt 0 ] && wait_for__PID="${1}"
|
|
877
|
+
[ ${#wait_for__PID} -gt 0 ] && kill "${wait_for__PID}"
|
|
878
|
+
}
|
|
879
|
+
#
|
|
880
|
+
##
|
|
881
|
+
#
|
|
882
|
+
# fselect()
|
|
883
|
+
fselect()
|
|
884
|
+
{
|
|
885
|
+
local FUNCT_NAME="fselect"
|
|
886
|
+
local IFS=$' \t\n'
|
|
887
|
+
#
|
|
888
|
+
#########################################
|
|
889
|
+
# Begin check for user custom geometry...
|
|
890
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
891
|
+
do
|
|
892
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
893
|
+
then
|
|
894
|
+
echo "width"
|
|
895
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
896
|
+
then
|
|
897
|
+
echo "height"
|
|
898
|
+
fi )"
|
|
899
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
900
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
901
|
+
done
|
|
902
|
+
# End check for user custom geometry...
|
|
903
|
+
#########################################
|
|
904
|
+
#
|
|
905
|
+
if [ ${#} -gt 0 ]
|
|
906
|
+
then
|
|
907
|
+
dir="${1}"
|
|
908
|
+
else
|
|
909
|
+
dir="${HOME}/"
|
|
910
|
+
fi
|
|
911
|
+
#
|
|
912
|
+
#########################################
|
|
913
|
+
echo -e "\n\n\n${frame}"
|
|
914
|
+
echo "$(basename "${eb_current_process_path}" ): file select"
|
|
915
|
+
echo "${frame}"
|
|
916
|
+
#
|
|
917
|
+
cd "${dir}"
|
|
918
|
+
while :
|
|
919
|
+
do
|
|
920
|
+
#
|
|
921
|
+
######################################
|
|
922
|
+
local IFS=$'\n'
|
|
923
|
+
args=( ".."
|
|
924
|
+
$(for element in $(find "${PWD}" -maxdepth 1 -type d | grep -v '~' )
|
|
925
|
+
do
|
|
926
|
+
echo "${element}/" | tr -s '/' | grep -v "^${PWD}/$"
|
|
927
|
+
done | sort )
|
|
928
|
+
$(for element in $(find "${PWD}" -maxdepth 1 -type f | grep -v '~' )
|
|
929
|
+
do
|
|
930
|
+
echo "${element}"
|
|
931
|
+
done | sort )
|
|
932
|
+
)
|
|
933
|
+
local IFS=$' \t\n'
|
|
934
|
+
: args[@]
|
|
935
|
+
#
|
|
936
|
+
#
|
|
937
|
+
IFS=$'\n'
|
|
938
|
+
select file_to_select in $(for ((index=0; index < ${#args[@]} ; index++)) ; do file_to_output="${args[${index}]}" ; echo "${file_to_output}" ; done )
|
|
939
|
+
do
|
|
940
|
+
if [ ${#file_to_select} -eq 0 ]
|
|
941
|
+
then
|
|
942
|
+
echo -e "\n\nErr.: Incorrect selection, please select only number."
|
|
943
|
+
sleep 1
|
|
944
|
+
echo -e "\n$(for ((index=0; index < ${#args[@]} ; index++)) ; do file_to_output="${args[${index}]}" ; echo "$((${index} + 1))) ${file_to_output}" ; done)"
|
|
945
|
+
else
|
|
946
|
+
break
|
|
947
|
+
fi
|
|
948
|
+
done
|
|
949
|
+
IFS=$' \t\n'
|
|
950
|
+
######################################
|
|
951
|
+
#
|
|
952
|
+
if [[ ${file_to_select} = .. ]]
|
|
953
|
+
then
|
|
954
|
+
cd ..
|
|
955
|
+
elif [[ ${file_to_select} = */ ]]
|
|
956
|
+
then
|
|
957
|
+
cd "${file_to_select}"
|
|
958
|
+
else
|
|
959
|
+
break
|
|
960
|
+
fi
|
|
961
|
+
#
|
|
962
|
+
done
|
|
963
|
+
cd "${dir}"
|
|
964
|
+
#
|
|
965
|
+
echo -e "${frame}\n"
|
|
966
|
+
echo
|
|
967
|
+
#########################################
|
|
968
|
+
#
|
|
969
|
+
echo "${file_to_select}" 1> "${dir_tmp}/${file_tmp}"
|
|
970
|
+
echo "${file_to_select}" 1>&2
|
|
971
|
+
#
|
|
972
|
+
}
|
|
973
|
+
# fselect()
|
|
974
|
+
#
|
|
975
|
+
##
|
|
976
|
+
#
|
|
977
|
+
# dselect()
|
|
978
|
+
dselect()
|
|
979
|
+
{
|
|
980
|
+
local FUNCT_NAME="dselect"
|
|
981
|
+
local IFS=$' \t\n'
|
|
982
|
+
#
|
|
983
|
+
#########################################
|
|
984
|
+
# Begin check for user custom geometry...
|
|
985
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
986
|
+
do
|
|
987
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
988
|
+
then
|
|
989
|
+
echo "width"
|
|
990
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
991
|
+
then
|
|
992
|
+
echo "height"
|
|
993
|
+
fi )"
|
|
994
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
995
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
996
|
+
done
|
|
997
|
+
# End check for user custom geometry...
|
|
998
|
+
#########################################
|
|
999
|
+
#
|
|
1000
|
+
if [ ${#} -gt 0 ]
|
|
1001
|
+
then
|
|
1002
|
+
dir="${1}"
|
|
1003
|
+
else
|
|
1004
|
+
dir="${HOME}/"
|
|
1005
|
+
fi
|
|
1006
|
+
#
|
|
1007
|
+
#########################################
|
|
1008
|
+
echo -e "\n\n\n${frame}"
|
|
1009
|
+
echo "$(basename "${eb_current_process_path}" ): dir select"
|
|
1010
|
+
echo "${frame}"
|
|
1011
|
+
#
|
|
1012
|
+
cd "${dir}"
|
|
1013
|
+
while :
|
|
1014
|
+
do
|
|
1015
|
+
#
|
|
1016
|
+
######################################
|
|
1017
|
+
local IFS=$'\n'
|
|
1018
|
+
args=( ".."
|
|
1019
|
+
$(for element in $(find "${PWD}" -maxdepth 1 -type d | grep -v '~' )
|
|
1020
|
+
do
|
|
1021
|
+
echo "${element}/" | tr -s '/'
|
|
1022
|
+
done | sort )
|
|
1023
|
+
)
|
|
1024
|
+
local IFS=$' \t\n'
|
|
1025
|
+
: args[@]
|
|
1026
|
+
#
|
|
1027
|
+
#
|
|
1028
|
+
IFS=$'\n'
|
|
1029
|
+
select dir_to_select in $(for ((index=0; index < ${#args[@]} ; index++)) ; do dir_to_output="${args[${index}]}" ; echo "${dir_to_output}" ; done )
|
|
1030
|
+
do
|
|
1031
|
+
if [ ${#dir_to_select} -eq 0 ]
|
|
1032
|
+
then
|
|
1033
|
+
echo -e "\n\nErr.: Incorrect selection, please select only number."
|
|
1034
|
+
sleep 1
|
|
1035
|
+
echo -e "\n$(for ((index=0; index < ${#args[@]} ; index++)) ; do dir_to_output="${args[${index}]}" ; echo "$((${index} + 1))) ${dir_to_output}" ; done)"
|
|
1036
|
+
else
|
|
1037
|
+
break
|
|
1038
|
+
fi
|
|
1039
|
+
done
|
|
1040
|
+
IFS=$' \t\n'
|
|
1041
|
+
######################################
|
|
1042
|
+
#
|
|
1043
|
+
if [[ ${dir_to_select} = .. ]]
|
|
1044
|
+
then
|
|
1045
|
+
cd ..
|
|
1046
|
+
elif [[ ${dir_to_select} = ${PWD}/ ]]
|
|
1047
|
+
then
|
|
1048
|
+
break
|
|
1049
|
+
else
|
|
1050
|
+
cd "${dir_to_select}"
|
|
1051
|
+
fi
|
|
1052
|
+
#
|
|
1053
|
+
done
|
|
1054
|
+
cd "${dir}"
|
|
1055
|
+
#
|
|
1056
|
+
echo -e "${frame}\n"
|
|
1057
|
+
echo
|
|
1058
|
+
#########################################
|
|
1059
|
+
#
|
|
1060
|
+
echo "${dir_to_select}" 1> "${dir_tmp}/${file_tmp}"
|
|
1061
|
+
echo "${dir_to_select}" 1>&2
|
|
1062
|
+
#
|
|
1063
|
+
}
|
|
1064
|
+
# dselect()
|
|
1065
|
+
#
|
|
1066
|
+
##
|
|
1067
|
+
#
|
|
1068
|
+
# menu()
|
|
1069
|
+
menu()
|
|
1070
|
+
{
|
|
1071
|
+
local FUNCT_NAME="menu"
|
|
1072
|
+
local IFS=$' \t\n'
|
|
1073
|
+
#
|
|
1074
|
+
#########################################
|
|
1075
|
+
# Begin check for user custom geometry...
|
|
1076
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1077
|
+
do
|
|
1078
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
1079
|
+
then
|
|
1080
|
+
echo "width"
|
|
1081
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1082
|
+
then
|
|
1083
|
+
echo "height"
|
|
1084
|
+
fi )"
|
|
1085
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
1086
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
1087
|
+
done
|
|
1088
|
+
# End check for user custom geometry...
|
|
1089
|
+
#########################################
|
|
1090
|
+
#
|
|
1091
|
+
unset args
|
|
1092
|
+
local IFS=$'\n'
|
|
1093
|
+
threshold=${#}
|
|
1094
|
+
args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
|
|
1095
|
+
do
|
|
1096
|
+
echo "${1}"
|
|
1097
|
+
shift
|
|
1098
|
+
done) )
|
|
1099
|
+
local IFS=$' \t\n'
|
|
1100
|
+
: args[@]
|
|
1101
|
+
#
|
|
1102
|
+
#########################################
|
|
1103
|
+
echo -e "\n\n\n${frame}"
|
|
1104
|
+
echo "$(basename "${eb_current_process_path}" ): menu"
|
|
1105
|
+
echo "${frame}"
|
|
1106
|
+
#
|
|
1107
|
+
IFS=$'\n'
|
|
1108
|
+
select item_to_select in $(for ((index=0; index < ${#args[@]} ; index++)) ; do item_to_output="${args[${index}]}" ; echo "${item_to_output}" ; done)
|
|
1109
|
+
do
|
|
1110
|
+
if [ ${#item_to_select} -eq 0 ]
|
|
1111
|
+
then
|
|
1112
|
+
echo -e "\n\nErr.: Incorrect selection, please select only number."
|
|
1113
|
+
sleep 1
|
|
1114
|
+
echo -e "\n$(for ((index=0; index < ${#args[@]} ; index++)) ; do item_to_output="${args[${index}]}" ; echo "$((${index} + 1))) ${item_to_output}" ; done)"
|
|
1115
|
+
else
|
|
1116
|
+
break
|
|
1117
|
+
fi
|
|
1118
|
+
done
|
|
1119
|
+
IFS=$' \t\n'
|
|
1120
|
+
#
|
|
1121
|
+
echo -e "${frame}\n"
|
|
1122
|
+
echo
|
|
1123
|
+
#########################################
|
|
1124
|
+
#
|
|
1125
|
+
echo "${item_to_select}" 1> "${dir_tmp}/${file_tmp}"
|
|
1126
|
+
echo "${item_to_select}" 1>&2
|
|
1127
|
+
#
|
|
1128
|
+
}
|
|
1129
|
+
# menu()
|
|
1130
|
+
#
|
|
1131
|
+
##
|
|
1132
|
+
#
|
|
1133
|
+
# tagged_menu()
|
|
1134
|
+
tagged_menu()
|
|
1135
|
+
{
|
|
1136
|
+
local FUNCT_NAME="tagged_menu"
|
|
1137
|
+
local IFS=$' \t\n'
|
|
1138
|
+
#
|
|
1139
|
+
#########################################
|
|
1140
|
+
# Begin check for user custom geometry...
|
|
1141
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1142
|
+
do
|
|
1143
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
1144
|
+
then
|
|
1145
|
+
echo "width"
|
|
1146
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1147
|
+
then
|
|
1148
|
+
echo "height"
|
|
1149
|
+
fi )"
|
|
1150
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
1151
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
1152
|
+
done
|
|
1153
|
+
# End check for user custom geometry...
|
|
1154
|
+
#########################################
|
|
1155
|
+
#
|
|
1156
|
+
unset tagged_tags
|
|
1157
|
+
unset tagged_args
|
|
1158
|
+
local IFS=$'\n'
|
|
1159
|
+
threshold=${#}
|
|
1160
|
+
for (( num=1,array_index=0 ; num <= ${threshold} ; num++,num++,array_index++ ))
|
|
1161
|
+
do
|
|
1162
|
+
tagged_tags[${array_index}]="${1}"
|
|
1163
|
+
tagged_args[${array_index}]="${2}"
|
|
1164
|
+
#
|
|
1165
|
+
shift ; shift
|
|
1166
|
+
done
|
|
1167
|
+
|
|
1168
|
+
local IFS=$' \t\n'
|
|
1169
|
+
: tagged_tags[@]
|
|
1170
|
+
: tagged_args[@]
|
|
1171
|
+
#
|
|
1172
|
+
#########################################
|
|
1173
|
+
#
|
|
1174
|
+
echo -e "\n\n\n${frame}"
|
|
1175
|
+
echo "$(basename "${eb_current_process_path}" ): tagged menu"
|
|
1176
|
+
echo "${frame}"
|
|
1177
|
+
#
|
|
1178
|
+
not_correct_answer="NO"
|
|
1179
|
+
while :
|
|
1180
|
+
do
|
|
1181
|
+
for ((index=0; index < ${#tagged_args[@]} ; index++)) ; do item_to_output="${tagged_args[${index}]}" ; echo "$((${index} + 1))) ${item_to_output}" ; done ; echo -n "#? "
|
|
1182
|
+
#
|
|
1183
|
+
read number
|
|
1184
|
+
if [ ${#number} -eq 0 ]
|
|
1185
|
+
then
|
|
1186
|
+
not_correct_answer="YES"
|
|
1187
|
+
#
|
|
1188
|
+
else
|
|
1189
|
+
if [ $(echo -n "${number}" | tr -dc [[:digit:]] | wc -c) -eq 0 ]
|
|
1190
|
+
then
|
|
1191
|
+
#
|
|
1192
|
+
not_correct_answer="YES"
|
|
1193
|
+
#
|
|
1194
|
+
else
|
|
1195
|
+
#
|
|
1196
|
+
[ ${number} -eq 0 -o ${number} -gt ${#tagged_args[@]} ] && not_correct_answer="YES"
|
|
1197
|
+
#
|
|
1198
|
+
fi
|
|
1199
|
+
#
|
|
1200
|
+
fi
|
|
1201
|
+
if [ "${not_correct_answer}" = "YES" ]
|
|
1202
|
+
then
|
|
1203
|
+
echo -e "\n\nErr.: Incorrect selection, please select only number (1->${#tagged_args[@]}).\n"
|
|
1204
|
+
sleep 1
|
|
1205
|
+
not_correct_answer="NO"
|
|
1206
|
+
continue 1
|
|
1207
|
+
fi
|
|
1208
|
+
#
|
|
1209
|
+
: number
|
|
1210
|
+
selected_index=$((${number} - 1))
|
|
1211
|
+
tag="${tagged_tags[${selected_index}]}"
|
|
1212
|
+
echo "${tag}" 1> "${dir_tmp}/${file_tmp}"
|
|
1213
|
+
break 1
|
|
1214
|
+
done
|
|
1215
|
+
#
|
|
1216
|
+
echo -e "${frame}\n"
|
|
1217
|
+
echo
|
|
1218
|
+
#########################################
|
|
1219
|
+
#
|
|
1220
|
+
echo "${tag}" 1>&2
|
|
1221
|
+
#
|
|
1222
|
+
}
|
|
1223
|
+
# tagged_menu()
|
|
1224
|
+
#
|
|
1225
|
+
##
|
|
1226
|
+
#
|
|
1227
|
+
# list()
|
|
1228
|
+
list()
|
|
1229
|
+
{
|
|
1230
|
+
local FUNCT_NAME="list"
|
|
1231
|
+
local IFS=$' \t\n'
|
|
1232
|
+
#
|
|
1233
|
+
: 1> "${dir_tmp}/${file_tmp}"
|
|
1234
|
+
#
|
|
1235
|
+
#########################################
|
|
1236
|
+
# Begin check for user custom geometry...
|
|
1237
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1238
|
+
do
|
|
1239
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
1240
|
+
then
|
|
1241
|
+
echo "width"
|
|
1242
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1243
|
+
then
|
|
1244
|
+
echo "height"
|
|
1245
|
+
fi )"
|
|
1246
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
1247
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
1248
|
+
done
|
|
1249
|
+
# End check for user custom geometry...
|
|
1250
|
+
#########################################
|
|
1251
|
+
#
|
|
1252
|
+
[ ${#PS3} -eq 0 ] && PS3="#?"
|
|
1253
|
+
exit_selection="DONE (exit from loop)"
|
|
1254
|
+
local IFS=$'\n'
|
|
1255
|
+
threshold=${#}
|
|
1256
|
+
args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
|
|
1257
|
+
do
|
|
1258
|
+
echo "${1}"
|
|
1259
|
+
shift
|
|
1260
|
+
done) "${exit_selection}" )
|
|
1261
|
+
local IFS=$' \t\n'
|
|
1262
|
+
: args[@]
|
|
1263
|
+
#
|
|
1264
|
+
for (( index=0 ; index < ${#args[@]} ; index++ ))
|
|
1265
|
+
do
|
|
1266
|
+
#
|
|
1267
|
+
arg_prog="${args[${index}]}"
|
|
1268
|
+
first_char="${arg_prog:0:1}"
|
|
1269
|
+
#
|
|
1270
|
+
if [ "${first_char}" = "+" ]
|
|
1271
|
+
then
|
|
1272
|
+
arg="${arg_prog:1}"
|
|
1273
|
+
#
|
|
1274
|
+
args[${index}]="*${arg}*"
|
|
1275
|
+
echo -e "${arg}" 1>> "${dir_tmp}/${file_tmp}"
|
|
1276
|
+
#
|
|
1277
|
+
else
|
|
1278
|
+
#
|
|
1279
|
+
if [ "${first_char}" = "-" ]
|
|
1280
|
+
then
|
|
1281
|
+
arg="${arg_prog:1}"
|
|
1282
|
+
else
|
|
1283
|
+
arg="${arg_prog}"
|
|
1284
|
+
fi
|
|
1285
|
+
#
|
|
1286
|
+
args[${index}]="${arg}"
|
|
1287
|
+
#
|
|
1288
|
+
fi #if [ "${first_char}" = "+" ]
|
|
1289
|
+
#
|
|
1290
|
+
done
|
|
1291
|
+
#
|
|
1292
|
+
items="$(0< "${dir_tmp}/${file_tmp}" )"
|
|
1293
|
+
#
|
|
1294
|
+
#########################################
|
|
1295
|
+
echo -e "\n\n\n${frame}"
|
|
1296
|
+
echo "$(basename "${eb_current_process_path}" ): list"
|
|
1297
|
+
echo "${frame}"
|
|
1298
|
+
#
|
|
1299
|
+
IFS=$'\n'
|
|
1300
|
+
while :
|
|
1301
|
+
do
|
|
1302
|
+
echo -e "\n$(for ((index=0; index < ${#args[@]} ; index++)) ; do item_to_output="${args[${index}]}" ; echo "$((${index} + 1))) ${item_to_output}" ; done)"
|
|
1303
|
+
echo -en "${PS3}"
|
|
1304
|
+
read index_plus_1
|
|
1305
|
+
#echo "${index_plus_1}" && break
|
|
1306
|
+
#
|
|
1307
|
+
if [ $(echo -n "${index_plus_1}" | tr -dc '[[:digit:]]' | wc -c) -eq 0 ]
|
|
1308
|
+
then
|
|
1309
|
+
echo -e "\n\nErr.: Incorrect selection, please select only number."
|
|
1310
|
+
sleep 1
|
|
1311
|
+
#
|
|
1312
|
+
else
|
|
1313
|
+
if [ ${index_plus_1} -gt ${#args[@]} ]
|
|
1314
|
+
then
|
|
1315
|
+
echo -e "\n\nErr.: Incorrect selection, please select a number less/equal than ${#args[@]}."
|
|
1316
|
+
sleep 1
|
|
1317
|
+
#
|
|
1318
|
+
else
|
|
1319
|
+
index_minus_1=$((${index_plus_1} - 1))
|
|
1320
|
+
item_to_select="${args[${index_minus_1}]}"
|
|
1321
|
+
#
|
|
1322
|
+
if [ "${item_to_select}" = "${exit_selection}" ]
|
|
1323
|
+
then
|
|
1324
|
+
break
|
|
1325
|
+
elif [ "${item_to_select}" != "${exit_selection}" ]
|
|
1326
|
+
then
|
|
1327
|
+
if [ $(echo "${item_to_select}" | grep "^\*.*\*$" | cut -d '*' -f 2 | wc -c ) -gt 0 -a $(echo "${items}" | grep "^$(echo "${item_to_select}" | cut -d '*' -f 2 )$" | wc -c ) -gt 0 ]
|
|
1328
|
+
then
|
|
1329
|
+
args[${index_minus_1}]="$(echo "${item_to_select}" | cut -d '*' -f 2 )"
|
|
1330
|
+
items="$(echo -e "${items}" | grep -v "^$(echo "${item_to_select}" | cut -d '*' -f 2 )$" | grep -v "^$" )"
|
|
1331
|
+
echo "Item #${index_plus_1} deselected."
|
|
1332
|
+
#echo -e "\${items} :\n${items}"
|
|
1333
|
+
#
|
|
1334
|
+
else
|
|
1335
|
+
args[${index_minus_1}]="*${item_to_select}*"
|
|
1336
|
+
items="$(echo -e "${items}\n${item_to_select}" | grep -v "^$" )"
|
|
1337
|
+
echo "Item #${index_plus_1} selected."
|
|
1338
|
+
#echo -e "\${items} :\n${items}"
|
|
1339
|
+
#
|
|
1340
|
+
fi
|
|
1341
|
+
: items
|
|
1342
|
+
#
|
|
1343
|
+
sleep 1 && continue
|
|
1344
|
+
fi
|
|
1345
|
+
fi
|
|
1346
|
+
fi
|
|
1347
|
+
done
|
|
1348
|
+
IFS=$' \t\n'
|
|
1349
|
+
#
|
|
1350
|
+
echo -e "${frame}\n"
|
|
1351
|
+
echo
|
|
1352
|
+
#########################################
|
|
1353
|
+
#
|
|
1354
|
+
echo "${items}" 1> "${dir_tmp}/${file_tmp}"
|
|
1355
|
+
echo "${items}" 1>&2
|
|
1356
|
+
#
|
|
1357
|
+
unset items
|
|
1358
|
+
#
|
|
1359
|
+
}
|
|
1360
|
+
# list()
|
|
1361
|
+
#
|
|
1362
|
+
##
|
|
1363
|
+
#
|
|
1364
|
+
# input()
|
|
1365
|
+
input()
|
|
1366
|
+
{
|
|
1367
|
+
local FUNCT_NAME="input"
|
|
1368
|
+
local IFS=$' \t\n'
|
|
1369
|
+
#
|
|
1370
|
+
#########################################
|
|
1371
|
+
# Begin check for user custom geometry...
|
|
1372
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1373
|
+
do
|
|
1374
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
1375
|
+
then
|
|
1376
|
+
echo "width"
|
|
1377
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1378
|
+
then
|
|
1379
|
+
echo "height"
|
|
1380
|
+
fi )"
|
|
1381
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
1382
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
1383
|
+
done
|
|
1384
|
+
# End check for user custom geometry...
|
|
1385
|
+
#########################################
|
|
1386
|
+
#
|
|
1387
|
+
: 1> "${dir_tmp}/${file_tmp}"
|
|
1388
|
+
#
|
|
1389
|
+
quanti_campi=${1}
|
|
1390
|
+
#
|
|
1391
|
+
shift #...perche' il primo parametro e': "quanti_campi" ...
|
|
1392
|
+
threshold=${#}
|
|
1393
|
+
local IFS=$'\n'
|
|
1394
|
+
args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
|
|
1395
|
+
do
|
|
1396
|
+
echo "${1}"
|
|
1397
|
+
shift
|
|
1398
|
+
done) )
|
|
1399
|
+
local IFS=$' \t\n'
|
|
1400
|
+
#
|
|
1401
|
+
#########################################
|
|
1402
|
+
echo -e "\n\n\n${frame}"
|
|
1403
|
+
echo "$(basename "${eb_current_process_path}" ): input"
|
|
1404
|
+
echo "${frame}"
|
|
1405
|
+
#
|
|
1406
|
+
for (( volta=1 ; volta <= $(( ${quanti_campi} * 2 )) ; volta++,volta++ ))
|
|
1407
|
+
do
|
|
1408
|
+
#
|
|
1409
|
+
testo="${args[$(( ${volta} - 1 ))]}"
|
|
1410
|
+
parametro="${args[${volta}]}"; [ ${#parametro} -eq 0 -a ${quanti_campi} -eq 1 ] && testo="Please, write data ..." && parametro="${args[$(( ${volta} - 1 ))]}"
|
|
1411
|
+
#
|
|
1412
|
+
#############
|
|
1413
|
+
#
|
|
1414
|
+
echo -e "\n############################"
|
|
1415
|
+
echo -e "${testo} [${parametro}]:"
|
|
1416
|
+
echo -e "############################"
|
|
1417
|
+
read scelta
|
|
1418
|
+
if [ ${#scelta} -eq 0 ]
|
|
1419
|
+
then
|
|
1420
|
+
scelta="${parametro}"
|
|
1421
|
+
fi
|
|
1422
|
+
#
|
|
1423
|
+
echo "${scelta}" 1>> "${dir_tmp}/${file_tmp}"
|
|
1424
|
+
#
|
|
1425
|
+
#############
|
|
1426
|
+
#
|
|
1427
|
+
if [ $(grep "${scelta}" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -gt 0 ]
|
|
1428
|
+
then
|
|
1429
|
+
:
|
|
1430
|
+
else
|
|
1431
|
+
question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\nContinue ?"
|
|
1432
|
+
if [ "${conferma}" -eq 0 ] #"Confermato"
|
|
1433
|
+
then
|
|
1434
|
+
:
|
|
1435
|
+
elif [ "${conferma}" -eq 1 ] #"Non confermato"
|
|
1436
|
+
then
|
|
1437
|
+
exit
|
|
1438
|
+
fi
|
|
1439
|
+
fi
|
|
1440
|
+
#
|
|
1441
|
+
done
|
|
1442
|
+
#
|
|
1443
|
+
echo -e "${frame}\n"
|
|
1444
|
+
echo
|
|
1445
|
+
#########################################
|
|
1446
|
+
#
|
|
1447
|
+
OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
|
|
1448
|
+
echo "${OUT_STDERR}" 1>&2
|
|
1449
|
+
#
|
|
1450
|
+
}
|
|
1451
|
+
# input()
|
|
1452
|
+
#
|
|
1453
|
+
##
|
|
1454
|
+
#
|
|
1455
|
+
# progress()
|
|
1456
|
+
progress()
|
|
1457
|
+
{
|
|
1458
|
+
local FUNCT_NAME="progress"
|
|
1459
|
+
local IFS=$' \t\n'
|
|
1460
|
+
#
|
|
1461
|
+
#########################################
|
|
1462
|
+
# Begin check for user custom geometry...
|
|
1463
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1464
|
+
do
|
|
1465
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
1466
|
+
then
|
|
1467
|
+
echo "width"
|
|
1468
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1469
|
+
then
|
|
1470
|
+
echo "height"
|
|
1471
|
+
fi )"
|
|
1472
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
1473
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
1474
|
+
done
|
|
1475
|
+
# End check for user custom geometry...
|
|
1476
|
+
#########################################
|
|
1477
|
+
#
|
|
1478
|
+
array_symbols=( '|' '|' '/' '-' '\' )
|
|
1479
|
+
#
|
|
1480
|
+
steps=100
|
|
1481
|
+
[ ${#} -eq 0 ] && testo="Progress" || testo="${1}"
|
|
1482
|
+
#
|
|
1483
|
+
if [ ${#} -ge 2 ]
|
|
1484
|
+
then
|
|
1485
|
+
if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ]
|
|
1486
|
+
then
|
|
1487
|
+
# Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
|
|
1488
|
+
alert_message "$(basename "${eb_current_process_path}" ): \n second argument \n\n must be an integer..."
|
|
1489
|
+
return
|
|
1490
|
+
#
|
|
1491
|
+
else
|
|
1492
|
+
quanti_sono_gli_elementi=$(echo -n "${2}" | tr -dc '[[:digit:]]' )
|
|
1493
|
+
steps=${quanti_sono_gli_elementi}
|
|
1494
|
+
#
|
|
1495
|
+
if [ ${quanti_sono_gli_elementi} -eq 0 ]
|
|
1496
|
+
then
|
|
1497
|
+
alert_message "$(basename "${eb_current_process_path}" ): \n this progress \n\n \"${testo}\" \n\n has 0 elements..."
|
|
1498
|
+
return
|
|
1499
|
+
fi
|
|
1500
|
+
#
|
|
1501
|
+
percentuale_di_1_elemento_sul_totale_degli_elementi=$(echo "scale=10; 100 / ${quanti_sono_gli_elementi}" | bc -l)
|
|
1502
|
+
if [ $(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 1 | tr -dc '[[:digit:]]' | wc -c) -eq 0 ]
|
|
1503
|
+
then
|
|
1504
|
+
secondo_numero=$(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 2)
|
|
1505
|
+
percentuale_di_1_elemento_sul_totale_degli_elementi="0.${secondo_numero}"
|
|
1506
|
+
fi
|
|
1507
|
+
#
|
|
1508
|
+
fi #if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ] # Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
|
|
1509
|
+
#
|
|
1510
|
+
fi #if [ ${#} -ge 2 ]
|
|
1511
|
+
#
|
|
1512
|
+
#########################################
|
|
1513
|
+
echo -e "\n\n\n${frame}"
|
|
1514
|
+
echo "$(basename "${eb_current_process_path}" ): progress"
|
|
1515
|
+
echo "${frame}"
|
|
1516
|
+
#
|
|
1517
|
+
echo -e "\n############################"
|
|
1518
|
+
echo -e "${testo} :"
|
|
1519
|
+
echo -e "############################"
|
|
1520
|
+
{
|
|
1521
|
+
index=0
|
|
1522
|
+
while read standard_input
|
|
1523
|
+
do
|
|
1524
|
+
if [ "${standard_input}" = "PROGRESS" ]
|
|
1525
|
+
then
|
|
1526
|
+
index=$(( ${index} + 1 ))
|
|
1527
|
+
percentuale=$(echo "scale=10; ${index} * ${percentuale_di_1_elemento_sul_totale_degli_elementi}" | bc -l )
|
|
1528
|
+
[ "X${percentuale%%.*}" = "X" ] && secondo_numero=${percentuale_di_1_elemento_sul_totale_degli_elementi##*.} && percentuale="0.${secondo_numero}"
|
|
1529
|
+
#
|
|
1530
|
+
echo "${percentuale%%.*}"
|
|
1531
|
+
#
|
|
1532
|
+
else
|
|
1533
|
+
#
|
|
1534
|
+
echo "${standard_input%%.*}"
|
|
1535
|
+
#
|
|
1536
|
+
fi
|
|
1537
|
+
done
|
|
1538
|
+
sleep 1
|
|
1539
|
+
} \
|
|
1540
|
+
| \
|
|
1541
|
+
\
|
|
1542
|
+
{
|
|
1543
|
+
for (( index_symb=0 ; ; index_symb++ ))
|
|
1544
|
+
do
|
|
1545
|
+
read percentuale_to_display
|
|
1546
|
+
if [ ${#percentuale_to_display} -eq 0 ]
|
|
1547
|
+
then
|
|
1548
|
+
break
|
|
1549
|
+
fi
|
|
1550
|
+
#
|
|
1551
|
+
symb="${array_symbols[${index_symb}]}"
|
|
1552
|
+
#
|
|
1553
|
+
echo -en "${percentuale_to_display}% ${symb} \r"
|
|
1554
|
+
#
|
|
1555
|
+
if [ ${index_symb} -eq $(( ${#array_symbols[@]} - 1 )) ]
|
|
1556
|
+
then
|
|
1557
|
+
index_symb="0"
|
|
1558
|
+
fi
|
|
1559
|
+
done
|
|
1560
|
+
}
|
|
1561
|
+
#
|
|
1562
|
+
echo
|
|
1563
|
+
echo -e "${frame}\n"
|
|
1564
|
+
echo
|
|
1565
|
+
#########################################
|
|
1566
|
+
#
|
|
1567
|
+
}
|
|
1568
|
+
# progress()
|
|
1569
|
+
#
|
|
1570
|
+
##
|
|
1571
|
+
#
|
|
1572
|
+
# adjust()
|
|
1573
|
+
adjust()
|
|
1574
|
+
{
|
|
1575
|
+
local FUNCT_NAME="adjust"
|
|
1576
|
+
local IFS=$' \t\n'
|
|
1577
|
+
#
|
|
1578
|
+
#########################################
|
|
1579
|
+
# Begin check for user custom geometry...
|
|
1580
|
+
while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1581
|
+
do
|
|
1582
|
+
w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
|
|
1583
|
+
then
|
|
1584
|
+
echo "width"
|
|
1585
|
+
elif [ "${1}" = "--height" -o "${1}" = "-h" ]
|
|
1586
|
+
then
|
|
1587
|
+
echo "height"
|
|
1588
|
+
fi )"
|
|
1589
|
+
parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
|
|
1590
|
+
reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
|
|
1591
|
+
done
|
|
1592
|
+
# End check for user custom geometry...
|
|
1593
|
+
#########################################
|
|
1594
|
+
#
|
|
1595
|
+
##
|
|
1596
|
+
#
|
|
1597
|
+
testo="${1-"Please adjust parameter..."}"
|
|
1598
|
+
#
|
|
1599
|
+
start_value=${2-"0"}
|
|
1600
|
+
init_value=${3-"50"}
|
|
1601
|
+
end_value=${4-"100"}
|
|
1602
|
+
#
|
|
1603
|
+
start_value_percent=0
|
|
1604
|
+
end_value_percent=100
|
|
1605
|
+
#
|
|
1606
|
+
num_tot_elementi=$(( ${end_value} - ${start_value} ))
|
|
1607
|
+
diff_values_percent=$(( ${end_value_percent} - ${start_value_percent} ))
|
|
1608
|
+
step=$(echo "scale=2; ${num_tot_elementi} / ${diff_values_percent}" | bc -l )
|
|
1609
|
+
# =>
|
|
1610
|
+
init_value_percent_float=$(echo "scale=2; $(( ${init_value} - ${start_value} )) / ${step}" | bc -l )
|
|
1611
|
+
init_value_percent=$(arrotonda "${init_value_percent_float}" )
|
|
1612
|
+
#
|
|
1613
|
+
#########################################
|
|
1614
|
+
echo -e "\n\n\n${frame}"
|
|
1615
|
+
echo "$(basename "${eb_current_process_path}" ): adjust"
|
|
1616
|
+
echo "${frame}"
|
|
1617
|
+
#
|
|
1618
|
+
echo -e "\n############################"
|
|
1619
|
+
echo -e "${testo} [${init_value_percent} %]:"
|
|
1620
|
+
echo "(please write percent)"
|
|
1621
|
+
echo -e "############################"
|
|
1622
|
+
read selected_value
|
|
1623
|
+
selected_value_percent="$(echo "${selected_value}" | tr -dc '[[:digit:]]' )"
|
|
1624
|
+
if [ ${#selected_value_percent} -eq 0 ]
|
|
1625
|
+
then
|
|
1626
|
+
selected_value_percent="${init_value_percent}"
|
|
1627
|
+
fi
|
|
1628
|
+
if [ ${selected_value_percent} -gt 100 ]
|
|
1629
|
+
then
|
|
1630
|
+
selected_value_percent=100
|
|
1631
|
+
fi
|
|
1632
|
+
echo "${selected_value_percent}" 1> "${dir_tmp}/${file_tmp}"
|
|
1633
|
+
#
|
|
1634
|
+
#
|
|
1635
|
+
value_percent=$(tr -dc '[[:digit:]]' 0< "${dir_tmp}/${file_tmp}" )
|
|
1636
|
+
: value_percent
|
|
1637
|
+
#
|
|
1638
|
+
final_value_temp=$(echo "scale=2; ${value_percent} * ${step}" | bc -l )
|
|
1639
|
+
final_value_float=$(echo "scale=2; ${start_value} + ${final_value_temp}" | bc -l )
|
|
1640
|
+
: final_value_float
|
|
1641
|
+
#
|
|
1642
|
+
final_value=$(arrotonda "${final_value_float}" )
|
|
1643
|
+
: final_value
|
|
1644
|
+
#
|
|
1645
|
+
echo "${final_value}" 1> "${dir_tmp}/${file_tmp}"
|
|
1646
|
+
#
|
|
1647
|
+
#####################################################
|
|
1648
|
+
#
|
|
1649
|
+
echo -e "${frame}\n"
|
|
1650
|
+
echo
|
|
1651
|
+
#########################################
|
|
1652
|
+
#
|
|
1653
|
+
OUT_STDERR="${final_value}"
|
|
1654
|
+
echo "${OUT_STDERR}" 1>&2
|
|
1655
|
+
}
|
|
1656
|
+
# adjust()
|
|
1657
|
+
#
|
|
1658
|
+
##
|
|
1659
|
+
#
|
|
1660
|
+
|
|
1661
|
+
echo -e "easybashgui: Fallback functions successfully loaded." 1>&2
|
|
1662
|
+
#
|
|
1663
|
+
##########################################
|
|
1664
|
+
#
|
|
1665
|
+
if [ "${easybashgui_debug_mode}" = "YES" ]
|
|
1666
|
+
then
|
|
1667
|
+
# enable some sane default checks to make bash scripts more robust
|
|
1668
|
+
# http://www.davidpashley.com/articles/writing-robust-shell-scripts.html
|
|
1669
|
+
echo "easybashgui_debug_mode ON" ; echo
|
|
1670
|
+
set -o nounset -o errexit
|
|
1671
|
+
shopt -s extdebug
|
|
1672
|
+
#
|
|
1673
|
+
elif [ "${easybashgui_debug_mode}" = "NO" ]
|
|
1674
|
+
then
|
|
1675
|
+
#
|
|
1676
|
+
#echo "easybashgui_debug_mode OFF"
|
|
1677
|
+
#set +o nounset +o errexit
|
|
1678
|
+
#shopt -u extdebug
|
|
1679
|
+
:
|
|
1680
|
+
#
|
|
1681
|
+
else
|
|
1682
|
+
#
|
|
1683
|
+
echo "easybashgui_debug_mode UNSET"
|
|
1684
|
+
:
|
|
1685
|
+
#
|
|
1686
|
+
fi
|
|
1687
|
+
##########################################à
|
|
1688
|
+
#
|
|
1689
|
+
|
|
1690
|
+
fi
|
|
1691
|
+
|
|
1692
|
+
|
|
1693
|
+
|
|
1694
|
+
|
|
1695
|
+
|