Where there can be any number of lines between each entry, I want to read these all into seperate arrays and a single variable for the database sid. I know how to grep for particular parts in the file, but its more getting the lines between them, could anyone give me some suggestions on how this can be done?
) ... ;;
Default case -> line doesn't start with @ -> Entry data ) eval ${entry}[\${#${entry}[]}]='$record' ;;
Generate and execute array assigment.
For example : FUNCTIONS[${#FUNCTIONS[]}='input line'
${#FUNCTIONS[*]} is the actual number of elements of the array. Since the index of array start with 0, it's also the value of the next array element.
This portion of code is generated by the eval command :
*) eval ${entry}[\${#${entry}[*]}]='$record' ;;
Looks like variable entry not assigned.
Initialize entry with a GARBAGE value to catch lines found before an @ entry. text entry=GARBAGE while read record do
the syntax of the expr command seems valid.
Add a trace option in the readReleaseFile function, that will permit to see the expr command that is executed. text readReleaseFile() { set -x
When i done the expr option, it gave the same error at the terminal window, however what I find weird is that the substr option appears in the man pages.
I am still working on this problem, well actually just getting back round to it, anyway I have implemented the arrays as suggested above but instead of having the output as above, i.e. with line: eval echo \"${array}[${i}]=\${${array}[${i}]}\"
I just want to place each value within the array into a variable.
Currently my code is:
for arrays in packageSpecs packageBodies procedures triggers functions views sqlScripts
do
eval count=\${#${arrays}[*]}
if [ $count -eq 0 ]
then
echo "$\{arrays\}: Nothing to be verified"
else
counter=0
while [ $counter -lt $count ]
do
eval echo \\"\\$\{$\{arrays\}[$\{counter\}]\}\\"
fileToVerify=eval \\$\{$\{arrays\}[$\{counter\}]\}\\
echo "Verifing: $fileToVerify"
counter=$counter\+1
done
fi
But this does not work as expected, I know its the line: fileToVerify=eval \${${arrays}[${counter}]}\ that gives me issues and have tried different ways to write this line looking at what agiles done above, can someone please tell me what I am doing wrong? Thanks