I'm sorry in advance that the question may be confusing.
I'm working with a command-line interface of a remote program, fw
that manages medical images. The program has their own documentation of commands that are similar in manner to bash commands (ls
in this example, in line 3 of my for
loop).
IDs
is an array of scan IDs, which I use to access the paths within the program, fw
, with the previously mentioned ls
command. The echo
line is just for my testing purposes. I would like to add each $line
to an array called ls
. Problem is, spacing in the output with back `` from fw ls
has spaces, and I'm trying to make it one string, since echo ${#ls[@]}
gives me a much larger number than what the true number of scans are (843 vs 3 for this example, 843 is from my actual debugging). The true number of what I'm working with is 67 scans to ls
instead of 3, but I only included three 'fake' outputs of line
to show you what the output looks like.
Debugging:
>>> echo ${line[@]}
admin Dec 3 15:37 2010-12-03 16:02:11
admin Mar 6 09:23 2014-03-06 09:31:16
admin Jul 23 11:12 2016-07-23 11:26:10
>>> echo ${#ls[@]}
843
### I should be getting
>>> echo ${#ls[@]}
3
How do I modify my line for appending to ls
in my for
loop?
for idx in ${IDs[@]}
do
line=`fw ls "myuniversity/test/${IDs[$idx]}/"`
echo $line
ls+=("$line")
done