I have 2 files, to perform some deployment operation.
helper.sh
#!/usr/bin/env bash
// some code
function2() {
local initial_asg_list=(${1})
local region=${2}
local current_build=${3}
local modified_shard_list=()
.
//some processing to populate modified_shard_list
echo "${modified_shard_list[*]}"
}
and another file is
File2.sh
#!/usr/bin/env bash
. "./helper.sh"
//some code
//some more code
function1() {
local shard_list=(shard1_name shard2_name shard3_name shard4_name)
local shard_list_to_process=($(function2 ${shard_list[*]}", "param2" "param3"))
echo "value obtained is ${shard_list_to_process[*]}"
}
on execution of function2 , output is
value obtained is 1
I refereed many docs, some say to use declare etc , but I dont want to use declare. Where exactly I am missing.If I want to use same code. Also , I need to maintain these 2 functions in separate file. Note, I tries with echo "${modified_shard_list[@]}" in helper file, getting same issue.