#!/bin/sh
i=0
while read line
do
for WORD in $line
do
#copy to array
array[$i]=$WORD
i=$((i+1))
done
done < ACTION_TAG.txt
File is saved with name .sh
I am trying to copy a file in array. it throws below error.
read.sh: 44: array[0]=sg: not found
read.sh: 44: array[1]=sg: not found
read.sh: 44: array[2]=sg: not found
read.sh: 44: array[3]=sg: not found
read.sh: 44: array[4]=sg: not found
read.sh: 44: array[5]=sg: not found
read.sh: 44: array[6]=sg: not found
read.sh: 44: array[7]=sg: not found
read.sh: 44: array[8]=sg: not found
read.sh: 44: array[9]=sg: not found
read.sh: 44: array[10]=sg: not found
read.sh: 44: array[11]=sg: not found
read.sh: 44: array[12]=sg: not found
read.sh: 44: array[13]=sg: not found
read.sh: 44: array[14]=sg: not found
read.sh: 44: array[15]=sg: not found
I went through the same queries posted on stackoverflow but was unable to solve problem. can some one help.