summaryrefslogtreecommitdiff
path: root/plugins/filecontent/bin/get.d.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2010-03-30 22:53:01 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:19 -0600
commita24ba8ab70f657e66c29dc66478a82a0d1d10eed (patch)
treeb4cf10e02df61a2d8e96c8f6331da91aea82cf28 /plugins/filecontent/bin/get.d.sh
parentc2f77a2e6fc273f118fa5e9e00f8d26197aefae1 (diff)
so, I realised that because:
* filedata was stipped down to just filename * the directory structure of files/filecontent stored member names then: * all filedata was really doing is storing filetype so, I decided to make filetype inherent of ID in a fairly elegant way
Diffstat (limited to 'plugins/filecontent/bin/get.d.sh')
-rw-r--r--plugins/filecontent/bin/get.d.sh18
1 files changed, 7 insertions, 11 deletions
diff --git a/plugins/filecontent/bin/get.d.sh b/plugins/filecontent/bin/get.d.sh
index 1723d8a..1a001d3 100644
--- a/plugins/filecontent/bin/get.d.sh
+++ b/plugins/filecontent/bin/get.d.sh
@@ -19,12 +19,12 @@ ver=0.9
#. "$LIBDIR/@ID@/stdio"
-# get.d ID DIRNAME
-id="$1"
-dir="$2"
+usage="usage: $RVS get.d DIRNAME ID"
+dir="${1?"$usage"}"
+ id="${2?"$usage"}"
tmp=`mktemp`
-"$RVS" get.f "$id" "$tmp"
+"$RVS" get.f "$tmp" "$id"
#install -d "$dir"
mkdir -p "$dir"
@@ -32,13 +32,9 @@ mkdir -p "$dir"
cd "$dir"
rm -rf ./*
while read line; do
- # GNU bash optimized version
- #hash=${line/#*:/}
- #name=${line/%:${hash}/}
- # POSIX version
- hash=`echo "$line" | sed 's/^.*://'`
- name=`echo "$line" | sed "s/:$hash$//"`
- "$RVS" get "$hash" "$name"
+ _id="`echo "$line" | sed 's/^.*://'`"
+ _name="`echo "$line" | sed 's@:'"$_id"'$@@'`"
+ "$RVS" get "$_name" "$_id"
done < "$tmp"
rm "$tmp"