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.
<? php $colors = array("Red", "Green", "Blue", "Yellow", "Orange"); // Loop through colors array foreach($colors as $value){ echo $value . "<br>"; } ?>
$1 means an input argument and -z means non-defined or empty. You're testing whether an input argument to the script was defined when running the script.
So as far as I can tell, %% doesn't have any special meaning in a bash function name. It would be just like using XX instead. This is despite the definition of a name in the manpage: name A word consisting only of alphanumeric characters and under- scores, and beginning with an alphabetic character or an under- score.
Use *
as the subscript to expand the array as a single word:
"${tabSuppr[*]}"
See man bash
for explanation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With