Execute an array of string describing shell command
问题 I'm struggling to execute a set of command lines stored as strings in an array. My code looks like this : arr=( "sudo apt-get update" "sudo apt-get install xxx" ) ... arr=( ${arr[@]} "ln -s /path1 /path2" ) etc... # Then I loop on the array of command for (( i = 0 ; i < ${#arr[@]} ; i++ )) do eval ${arr[$i]} done When it loops over the array, the array is larger than the number of command stored into it. As if the blank spaces in my strings split the array in more elements A typical ouput is