#!/bin/bash
tmp_file=/tmp/rox-tmp

rm -f $tmp_file
touch $tmp_file

path=$(cat ~/.ivman/mounted/$1)
echo "el path es $path"
label=$1
echo "el 1 es $1"

spot=$(grep "$label" ~/.ivman/mounted/.locations -n | awk '{ print substr($0, 1, 1) }')
lines=$(cat ~/.ivman/mounted/.locations | wc -l)

head -n $((spot-1)) ~/.ivman/mounted/.locations >> $tmp_file
echo >> $tmp_file
tail -n $((lines-spot)) ~/.ivman/mounted/.locations >> $tmp_file
mv $tmp_file ~/.ivman/mounted/.locations

rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
 <env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
   <PinboardRemove>
      <Path>$path</Path>
         <Label>$label</Label>
	   </PinboardRemove>
	    </env:Body>
	    </env:Envelope>
