Hi Team,
Could you please explain me the usage of set +A command in setting values to an array ?
Also, what does the below command do ?
set +A filesSent ${filesSent[*]},${file}${FLAGEXT}
Thanks in advance.
Regards,
Mohan
Hi Team,
Could you please explain me the usage of set +A command in setting values to an array ?
Also, what does the below command do ?
set +A filesSent ${filesSent[*]},${file}${FLAGEXT}
Thanks in advance.
Regards,
Mohan
set -A or set +A works only in ksh, not in bash.
set -A arrayname list of values
Add echo before cmdline = see the result = howto shell expand commandline = after
that has done command.
You can make the list so many ways
# number of elements in array
${#array[*]}
# all elements
${array[*]}
1st element index is 0
echo "1st:${array[0]}"
#
last=${#array[*]}
((last -= 1 ))
echo "last:${array[$last]}"
And last, shift array - remove 1st element
set -A array "${array[@]:1}"
KshJi, I just need only clarification.. What is the differeence between +A and -A ?
Man says something but I have seen any differences. If arg list is empty, in both case array include still values. Maybe the reason is +/- which is normal for set options. Added only support for both, even result is same.
---------- Post updated at 11:09 AM ---------- Previous update was at 11:06 AM ----------
It is easy to hope:
set -A remove from the array
set +A add to the array
but no.