Hi,
I have requirement to assign values to variables which are created dynamically.
Below is the code which i am using to achieve above requirement.
#!/bin/ksh
oIFS="$IFS"; IFS=','
STR_FAIL_PARENT_IF_FAILS="WF_F_P_IF_FAILS1,WF_F_P_IF_FAILS2,WF_F_P_IF_FAILS3"
set -A WF_FAIL_PARENT_IF_FAILS $STR_FAIL_PARENT_IF_FAILS
wfnodeval4taskin="<TASKINSTANCE DESCRIPTION='' FAIL_PARENT_IF_INSTANCE_DID_NOT_RUN='YES' FAIL_PARENT_IF_INSTANCE_FAILS='YES' ISENABLED='NO' NAME='EventWait' REUSABLE='NO' TASKNAME='EventWait' TASKTYPE='Event Wait' TREAT_INPUTLINK_AS_AND='YES'/>"
echo "Length:${#WF_FAIL_PARENT_IF_FAILS[@]}"
for WF_TREAT_LINKS_VAL in ${WF_FAIL_PARENT_IF_FAILS[@]};
do
if [ -z $WF_TREAT_LINKS_VAL ]; then
$WF_TREAT_LINKS_VAL="$(echo $wfnodeval4taskin | grep -o " TREAT_INPUTLINK_AS_AND='[^']*'" | sed 's/^ *//;s/ *$//')"
break
fi
done
IFS="$oIFS"
wfnodeval4taskin string value is dynamic which is coming from file. Now i want to read all values from Array and assign values to that in case if that variables has no value.
I want to check first $WF_TREAT_LINKS_VAL is null or not if not null loop and until i get variable which has no value and assign derived value.
Finally i want to assign value to WF_F_P_IF_FAILS1=xxxxx
Thanks for your help.
Mallik.