1 From 2127850302de2bd8dccff0e31415ce0218750773 Mon Sep 17 00:00:00 2001
2 From: Ioana Ciornei <ioana.ciornei@nxp.com>
3 Date: Tue, 24 Oct 2017 16:29:53 +0000
4 Subject: [PATCH 06/12] scripts: use strings instead of arrays
6 Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
8 scripts/ls-main | 21 ++++++++++++++-------
9 1 file changed, 14 insertions(+), 7 deletions(-)
11 diff --git a/scripts/ls-main b/scripts/ls-main
12 index a39df2c..b0c742e 100755
15 @@ -485,7 +485,9 @@ create_dpsw() {
17 # Make a link in case there is an end point specified
19 - for i in "${endpoint[@]}"; do
20 + echo "${endpoint}" |
23 connect $root_c "$dpsw.$index" "$i"
26 @@ -519,8 +521,8 @@ process_addsw() {
30 - #Endpoint objects provided as argument
32 + # Endpoint objects provided as argument
37 @@ -559,7 +561,7 @@ process_addsw() {
40 @(dpni|dpmac).+([0-9]))
41 - endpoint[$ifcnt]="$(echo ${i#*=} | tr -d ,)"
42 + endpoint="${endpoint}"$'\n'"${i}"
46 @@ -571,14 +573,19 @@ process_addsw() {
49 # Check if there are more endpoints provided than the number of the interfaces
50 - if [ $num_ifs -lt ${#endpoint[@]} ]; then
51 + if [ $num_ifs -lt $ifcnt ]; then
52 echo "Error: there are more endpoints provided than the number of the interfaces"
57 + # Delete first empty line from the endpoint string
58 + endpoint="$(echo "${endpoint}" | tail -n +2)"
60 # Check if the endpoints are valid
61 - for i in "${endpoint[@]}"; do
62 + echo "${endpoint}" |
68 @@ -592,7 +599,7 @@ process_addsw() {
69 if (( $object_exists_status == 1 )); then
70 echo "Created ETHSW object $dpsw with ${num_ifs} ports"
72 - if [ $num_ifs -gt ${#endpoint[@]} ]; then
73 + if [ $num_ifs -gt $ifcnt ]; then
74 echo "Do not forget to connect devices to interface(s)."