diff options
author | Heiko Bernloehr <Heiko.Bernloehr@FreeIT.de> | 2012-09-20 13:47:18 +0200 |
---|---|---|
committer | Heiko Bernloehr <Heiko.Bernloehr@FreeIT.de> | 2012-09-20 14:01:15 +0200 |
commit | b8dd643705c75672dd97141544ec567bfe0d41b9 (patch) | |
tree | b990f5da29734fd5c14a3b040d2b5cf2866788aa /campusconnect | |
parent | 9a54a7b028ad27f8a72b8af987768130aadbc335 (diff) | |
download | ecs2-b8dd643705c75672dd97141544ec567bfe0d41b9.tar.gz ecs2-b8dd643705c75672dd97141544ec567bfe0d41b9.zip |
Bugfixing lsfproxy.sh shell incompatibilities.
Testscript:
DATA_URL_ID=1
DATA_URL1='http://freeit.de'
echo `eval expr $"DATA_URL$DATA_URL_ID"`
echo $(eval expr $"DATA_URL$DATA_URL_ID")
echo $(eval expr \$"DATA_URL$DATA_URL_ID")
echo $(eval echo \$"DATA_URL$DATA_URL_ID")
In dash (version 0.5.5.1-7.4) all 4 echo commands works as expected and
spit out:
http://freeit.de
http://freeit.de
http://freeit.de
http://freeit.de
In bash (version 4.1.5) you get:
DATA_URL1
DATA_URL1
http://freeit.de
http://freeit.de
One reason for this misbehaviour of the script is because bash
interprets the sequence $"string" (see manpage):
"... a dollar sign ($"string") will cause the string to be translated
according to the current locale ..."
Diffstat (limited to 'campusconnect')
-rwxr-xr-x | campusconnect/scripts/lsfproxy.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/campusconnect/scripts/lsfproxy.sh b/campusconnect/scripts/lsfproxy.sh index 1e8a5fe..db8fc05 100755 --- a/campusconnect/scripts/lsfproxy.sh +++ b/campusconnect/scripts/lsfproxy.sh @@ -118,7 +118,7 @@ fi curl $CURL_OPTIONS --cacert $CACERT --cert $CERT --key $KEY --pass $PASS \ -H "Content-Type: text/uri-list" \ -H "X-EcsReceiverMemberships: $MID" \ - -d `eval expr $"DATA_URL$DATA_URL_ID"` \ + -d $(eval echo \$"DATA_URL$DATA_URL_ID") \ -X POST $ECS_URL/$RESOURCE echo "" } @@ -147,7 +147,7 @@ fi curl $CURL_OPTIONS --cacert $CACERT --cert $CERT --key $KEY --pass $PASS \ -H "Content-Type: text/uri-list" \ -H "X-EcsReceiverMemberships: $MID" \ - -d `eval expr $"DATA_URL$DATA_URL_ID"` \ + -d $(eval echo \$"DATA_URL$DATA_URL_ID") \ -X PUT $ECS_URL/$RESOURCE/$RID echo "" } |