|
1 | 1 | # easybashlib - EasyBash Library... |
2 | 2 | # |
3 | | -# Hint: If you are just using a random editor, try Geany. |
4 | | -# |
5 | 3 | # For more lib modules and improvement ideas see: |
6 | 4 | # http://dberkholz.com/2011/04/07/bash-shell-scripting-libraries/ |
7 | 5 |
|
@@ -179,8 +177,6 @@ function eb_error_output() |
179 | 177 | ##################### |
180 | 178 |
|
181 | 179 |
|
182 | | - |
183 | | - |
184 | 180 | function eb_kill_process_tree_of_pid() { |
185 | 181 | # Grows a process tree that can kill an existing process tree beginning with |
186 | 182 | # the given PID as parent. |
@@ -231,15 +227,11 @@ function eb_kill_process_tree_of_pid() { |
231 | 227 | fi |
232 | 228 | done |
233 | 229 |
|
234 | | - |
235 | 230 | } |
236 | 231 |
|
237 | 232 |
|
238 | 233 |
|
239 | 234 |
|
240 | | - |
241 | | - |
242 | | - |
243 | 235 | # Define a mechanism for automatic clean up on exit, based upon the idea |
244 | 236 | # http://www.linuxjournal.com/content/use-bash-trap-statement-cleanup-temporary-files |
245 | 237 | # |
@@ -297,15 +289,11 @@ ebg_add_on_exit() |
297 | 289 |
|
298 | 290 |
|
299 | 291 |
|
300 | | - |
301 | | - |
302 | | - |
303 | 292 | ############### |
304 | 293 | # Directories # |
305 | 294 | ############### |
306 | 295 |
|
307 | 296 |
|
308 | | - |
309 | 297 | # determine eb_conf_dir |
310 | 298 | if [ "${USERPROFILE:-undefined}" = undefined ] |
311 | 299 | then |
@@ -351,7 +339,6 @@ eb_debug_output "eb_log_dir is set to $eb_log_dir" |
351 | 339 |
|
352 | 340 |
|
353 | 341 |
|
354 | | - |
355 | 342 | # determine eb_persistence_dir |
356 | 343 | if [ "${USERPROFILE:-undefined}" = undefined ] |
357 | 344 | then |
|
440 | 427 |
|
441 | 428 |
|
442 | 429 |
|
443 | | - |
444 | | - |
445 | 430 | ########## |
446 | 431 | # Checks # |
447 | 432 | ########## |
448 | 433 |
|
449 | 434 |
|
450 | | - |
451 | 435 | function eb_gen_check_code() |
452 | 436 | # Generates code to check the tests given as parameters (all tests if none was specified). |
453 | 437 | # Usefull to run selections of tests in context as needed. |
@@ -533,29 +517,28 @@ function eb_check_local() |
533 | 517 | eb_map() { |
534 | 518 | #parameters: action, storage_type, key, value, process_name |
535 | 519 |
|
536 | | - [ "$#" -lt 2 ] && exit 1 |
537 | | - local action="$1" |
538 | | - local storage_type="$2" |
539 | | - local mapname="$3" |
540 | | - local key="$4" |
541 | | - local value="$5" |
| 520 | + [ "${#}" -lt 2 ] && exit 1 |
| 521 | + local action="${1}" |
| 522 | + local storage_type="${2}" |
| 523 | + local mapname="${3}" |
| 524 | + local key="${4}" |
| 525 | + local value="${5}" |
542 | 526 | local process_name="${6:-${eb_runtime_invoke_name}}" |
543 | 527 | local mapdir |
544 | 528 |
|
545 | | - if [ "$storage_type" = "persistent" ] |
546 | | - then |
| 529 | + if [ "${storage_type}" = "persistent" ] |
| 530 | + then |
547 | 531 | mapdir="${eb_persistence_basedir}/${process_name}/eb_key-value-maps" |
548 | 532 | else |
549 | 533 | mapdir="$(eb_get_state_dir ${process_name})/eb_key-value-maps" |
550 | 534 | fi |
551 | 535 |
|
552 | | - if [ "$action" = "put" ] |
553 | | - then |
| 536 | + if [ "${action}" = "put" ] |
| 537 | + then |
554 | 538 | [ -d "${mapdir}/${mapname}" ] || mkdir -p "${mapdir}/${mapname}" |
555 | 539 | echo $value >"${mapdir}/${mapname}/${key}" |
556 | | - |
557 | | - elif [ "$action" = "get" ] |
558 | | - then |
| 540 | + elif [ "${action}" = "get" ] |
| 541 | + then |
559 | 542 | cat "${mapdir}/${mapname}/${key}" |
560 | 543 | fi |
561 | 544 | } |
|
0 commit comments