Command does not work in script file, but works ok with shell command

Viewed 39

I have a script here that when executed in shell command it produces the output I am expecting

greatwall:nobody:/v6/centera/cnaccs> ./consDownload.cgi 277756541642 5 0
CI,JPJA,ETD,0b0dbba1d2f1278H,202209081947|CO,JPJA,ETD,0b0dbba1d2f1278H,202209081947|AWB,JPJA,ETD,0b0dbba1d2f1278H,202209081947|

But when the same command was executed inside a shell script it encountered an error

Line inside shell script

op=$(./consDownload.cgi "$AWB" "5" "0" 2>&1)
timeStamp "op=$op"

Error from logs

op=./consDownload.cgi: line 148: openssl: command not found

line 148 from consDownload script

OPENSSL="openssl"
AUTHZID="APP83"
SERVICEID="APP5285"
PRIVATEKEY="./app83.pem"
TOKEN="$(echo -n "$SERVICEID:$(TZ=Asia/Singapore date +%s)000" | "$OPENSSL" rsautl -inkey "$PRIVATEKEY" -sign -pkcs | base64 -w 0)"
TOKEN="v1:$AUTHZID:$TOKEN:$AUTHZID"

but when I checked, openssl is installed on server

greatwall:nobody:/v6/centera/cnaccs> openssl version
OpenSSL 1.0.2q  20 Nov 2018
0 Answers
Related