I have a script which runs fine when executed in Bash shell (with Red Hat Linux), however this same script which fails on a Solaris 10 (DB) server where ksh is being used to execute this script. This script basically reads line by line from a file and executes a stored proc (in Oracle). Below is my script :
#/bin/sh
for i in $(cat subscriber.txt); do
SUBSCRIBER_ID="'$i'"
sqlplus -s myuser/myuser <<EOF
execute delete_learnings($SUBSCRIBER_ID);
commit;
EXIT
EOF
done
The error I get is :
./removeLearnings.sh: syntax error at line 3: `$' unexpected
Any idea what might be going wrong? Should I change the script to have the ksh? I am not able to debug on this machine since it's a customer environment (which I don't have access to).
/bin/shis not POSIX compliant and does not recognize the$(…)notation — unless, perhaps, you have Solaris 11. Note that you're not usingksh; the shebang says#!/bin/shand not#!/bin/ksh.