Hi, I'm running into following issue, my_file is a collection of windows directories (i.e \\path\directory\file) . I need to be able to execute "my command" as
my command \\path\directory\file
I know that while read -r / print -r ignores backslashes.
My code:
cat $my_file | while read -r line
do
my_array[$i]=$line
(( i = i + 1 ))
myarray[i]=$line
done
(( h = 0 ))
while (( h < `cat $my_file | wc -l ))
do
my command ${my_array[h]}
this executes incorrect values
print -r "my command ${my_array[h]}"
this sends correct output to the screen
(( h = h + 1 ))
done
Appreciate any help.
I do not understand your question. If the command I gave you resulted in 11 copies of the array element being passed, I cannot explain that. I would have expected only one copy.
no, what I am saying is I have a number of arrays to pass to eval, my question is if I do
eval my command \'${my_array[h]}\' my array returns a long string and if I have say three arrays to pass can I do each one on new line and how will eval interpret it?