cleanup
This commit is contained in:
+18
-15
@@ -5,6 +5,23 @@
|
|||||||
BASEDIR=$(dirname "$0")
|
BASEDIR=$(dirname "$0")
|
||||||
readonly BASEDIR
|
readonly BASEDIR
|
||||||
|
|
||||||
|
# SCENARII
|
||||||
|
|
||||||
|
function do_success {
|
||||||
|
echo -n 'SUCCESS args=['
|
||||||
|
(
|
||||||
|
IFS=','
|
||||||
|
echo -n "$*"
|
||||||
|
)
|
||||||
|
echo ']'
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_unbound_variable {
|
||||||
|
a=5
|
||||||
|
echo "a=${a}"
|
||||||
|
echo "b=${b}"
|
||||||
|
}
|
||||||
|
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
|
|
||||||
function F2 {
|
function F2 {
|
||||||
@@ -61,24 +78,10 @@ function usage {
|
|||||||
echo -e "\tthese case scenarii helps testing the miaou-bash script"
|
echo -e "\tthese case scenarii helps testing the miaou-bash script"
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_success {
|
|
||||||
echo -n 'SUCCESS args=['
|
|
||||||
(
|
|
||||||
IFS='|'
|
|
||||||
echo -n "$*"
|
|
||||||
)
|
|
||||||
echo ']'
|
|
||||||
}
|
|
||||||
|
|
||||||
function do_unbound_variable {
|
|
||||||
a=5
|
|
||||||
echo "a=${a}"
|
|
||||||
echo "b=${b}"
|
|
||||||
}
|
|
||||||
|
|
||||||
function introspect_scenarii {
|
function introspect_scenarii {
|
||||||
mapfile -t SCENARII <<<"$(compgen -A function | grep ^do_ | sed 's/...//')"
|
mapfile -t SCENARII <<<"$(compgen -A function | grep ^do_ | sed 's/...//')"
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_contain_item {
|
function test_contain_item {
|
||||||
local -n array=$1
|
local -n array=$1
|
||||||
for item in "${array[@]}"; do [[ "$item" == "$2" ]] && return 0; done
|
for item in "${array[@]}"; do [[ "$item" == "$2" ]] && return 0; done
|
||||||
|
|||||||
Reference in New Issue
Block a user