-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_show_attributes
executable file
·54 lines (44 loc) · 1.11 KB
/
test_show_attributes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
source mod_common
bi_enable
bogus_test()
{
echo "Function to see if show_attributes can identify a function variable"
}
run_test()
{
local_func() { :; }
local genericvar="generic"
local -i intvar=1
local -a arrvar=( 1 2 3 4 5 )
local -A hashvar=( 1 "one" 2 "two" 3 "three" )
local funcvar=bogus_test
local -a post_assign_arr
local -n nameref="arrvar"
local -n nameref_cmd="local_func"
post_assign_arr=( 5 4 3 2 1 )
local -a args=(
genericvar
intvar
arrvar
hashvar
funcvar
post_assign_arr
bogus_test
local_func
nameref
nameref_cmd
)
for arg in "${args[@]}"; do
read -n1 -p "Press any key to itemize attributes of ${B}${arg}${X}."
echo $'\e[2J'
show_attributes "$arg"
done
}
cat <<EOF
This is a simple test of the ${B}show_attributes${X} builtin function.
The test will try different variable types to observe the outout.
I intend to assign and identify a function variable, that is one that
is created with the ${B}-f${X} option.
EOF
run_test