#!/bin/sh -x

TEMP1=$(mktemp)
TEMP2=$(mktemp)

grep -hv ${myID} ${SHARE_LIST} > ${TEMP1}

${BINARY} cli config folders list > ${TEMP2}

for i in `cat ${TEMP1}`
do
    echo $i
    for j in `cat ${TEMP2}`
    do
        echo $j
        ${BINARY} cli config folders $j devices add --device-id=$i
    done
done

rm -f ${TEMP1} ${TEMP2}

