summaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src/main/resources/misc/provcmd
diff options
context:
space:
mode:
Diffstat (limited to 'datarouter-prov/src/main/resources/misc/provcmd')
-rw-r--r--datarouter-prov/src/main/resources/misc/provcmd15
1 files changed, 15 insertions, 0 deletions
diff --git a/datarouter-prov/src/main/resources/misc/provcmd b/datarouter-prov/src/main/resources/misc/provcmd
index 75d0bffa..e3654eb9 100644
--- a/datarouter-prov/src/main/resources/misc/provcmd
+++ b/datarouter-prov/src/main/resources/misc/provcmd
@@ -19,6 +19,21 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+urlencode() {
+ local data
+ if [[ $# != 1 ]]; then
+ echo "Usage: $0 string-to-urlencode"
+ return 1
+ fi
+ data="$(curl -s -o /dev/null -w %url_effective --get --data-urlencode "$1" "")"
+ if [[ $? != 3 ]]; then
+ echo "Unexpected error" 1>&2
+ return 2
+ fi
+ echo "${data##/?}"
+ return 0
+}
+export urlencode
PATH=/opt/app/datartr/bin:/bin:/usr/bin:$PATH
PROVCMD="$0"