[Solved] reassign value to variable

Hi,
Please let me know how to reassign value to a variable.The calling script is passing parameter as HAT_DIV but I like to pass HAT DIV ( two words) to DIV parameter.These are .ksh scripts.

# access to target - (user passwd sid) must be provided.
USER=$1;                                 export USER
PASSWD=$2;                               export PASSWD
SID=$3;                                  export SID
DB=$4;                                  export PDM_DB
DIV=$5;                                  export DIV
DEPT=$6;                                 export DEPT
if [ $5 eq HAT_DIV ]; then
 DIV="HAT DIV";
fi
$ORACLE_HOME/bin/sqlplus ${USER}/${PASSWD}@${SID} >>./run_convert_${DEPT}.log <<EOC
whenever sqlerror exit 1
 execute CNVT_SUMMARY('${DB}', '${OWNER}','${DIV}','${DEPT}');
EOC
if [ $? -eq 1 ]; then
  echo "Error in the stored procedure CNVT_SUMMARY";
  echo $DIV;
  printf "%s\n" "$@";
  exit 1
fi

how parameters being passed

U CNVT_SUMMARY.ksh scott tiger testdb fashion HAT_DIV 12

This is error message.

eq: 0403-012 A test command parameter is not valid.

Thanks
Sandy

What issues are u getting? is it not due to eq and not -eq?

You don't mention which shell you are using. Assuming it's bash, the assignment seems correct, but the preceding if construct will not work. Replace the "eq" (should be -eq anyhow), which compares integers, with "==", which compares strings.

Please find the updated information in my first post.

I hope you found the answer for the error.. or else please read the man page for TEST command u fill find the solution in seconds :wink: :b:

this worked for me.

if [ "$5" = "HAT_DIV" ]; then
 DIV="HAT DIV";
fi

Thanks.