Why are “declare -f” and “declare -a” needed in bash scripts?
问题 Sorry for so innocent question - I just try to undertand... For example - I have: $ cat test.sh #!/bin/bash declare -f testfunct testfunct () { echo "I'm function" } testfunct declare -a testarr testarr=([1]=arr1 [2]=arr2 [3]=arr3) echo ${testarr[@]} And when I run it I get: $ ./test.sh I'm function arr1 arr2 arr3 So here is a question - for what i must (if must...) insert declare here? With it - or without it it works the same... I can understand for example declare -i var or declare -r var