I am making a bash script using dialog. My script make the difference between files in two tar.gz. Each add files are put in an array and each delete files are put in an other array.
All files are add in my two array and when I want echo them it's works
echo ${tabAjout[@]}
echo ${tabSuppr[@]}
The output is :
bonjour.txt.gpg test2.txt.gpg test.txt.gpg
hello.txt.gpg
Now I want add this in msgbox.
function affiche_message(){
#Personnalisation de la fenêtre
$DIALOG --title "$1" \
--msgbox "$2" 20 45
}
Call function :
affiche_message "Title" "Delete : ${tabSuppr[@]} \n\n Add : ${tabAjout[@]}"
When I run my script the msgbox contains only the first values of the array. If I change ${tabAjout[@]} by ${#tabAjout[@]} the dialog windows echo that array contains 3 values.
Use
*
as the subscript to expand the array as a single word:See
man bash
for explanation.