iwhd: a few new problems, but nothing urgent (iwhd-clean-repo script)

Jim Meyering jim at meyering.net
Thu Nov 17 21:49:19 UTC 2011


Jim Meyering wrote:
> Today I wrote a quick and very dirty bourne shell script (below) to
...
>     echo curl -f -X DELETE "$b/$o"
>   done
> done

If you actually want that script to do something,
change "echo curl" to "curl":

      echo curl -f -X DELETE "$b/$o"

iwhd-clean-repo
------------------------------------------------
#!/bin/sh
# Remove all objects and attributes from a running iwhd.
# Do not attempt (currently not possible) to remove buckets.

# E.g., usage: $0 http://localhost:9095
url=$1

curl() { env curl -H 'Accept: */json' "$@"; }

buckets=$(curl $url \
  | perl -nle '/^\s+"link": "(.*?)",?$/ and print $1' \
  | grep -vE '(/_new|_providers)$')

for b in $(echo $buckets); do
  obj=$(curl $b \
	| perl -nle '/^\s+"key": "(.*?)",?$/ and print $1')
  for o in $(echo $obj); do
    curl -f -X DELETE "$b/$o"
  done
done


More information about the iwhd-devel mailing list