git -C $MEDIA/$folder remote -v | while read remote; do
cd $DEST/$MEDIA/$folder
name="`echo $remote | cut -d ' ' -f 1`"
- addr="`echo $remote | cut -d ' ' -f 2`"
+ addr="`echo $remote | cut -d ' ' -f 2`"
type="`echo $remote | cut -d ' ' -f 3`"
if [ "$type" == "(push)" ]; then
git -C $DEST/$MEDIA/$folder remote -v | while read remote; do
cd $MEDIA/$folder
name="`echo $remote | cut -d ' ' -f 1`"
- addr="`echo $remote | cut -d ' ' -f 2`"
+ addr="`echo $remote | cut -d ' ' -f 2`"
type="`echo $remote | cut -d ' ' -f 3`"
if [ "$type" == "(push)" ]; then
fi
if ! git remote -v | sed -e 's/\t/ /g' | grep -q "^$name $addr $type$"; then
- git -C $DEST/$MEDIA/$folder remote $command $name $arg
+ # Check if was not already removed by a previous command
+ if git -C $DEST/$MEDIA/$folder remote | grep -q "^$name$"; then
+ git -C $DEST/$MEDIA/$folder remote $command $name $arg
+ fi
fi
done
fi