I am creating a script which will prompt a user to enter a location of a text file and based from that it will create an array.First QuestionThe text file that I am using is sample.txt and it is located on the ~/Desktop/ but it is not outputting all the data to the output.txtFirst ScriptINDEX=0echo -n Enter a name for the array: read NAMEwhile read LINEdo  echo $NAME[$INDEX]=\$LINE\ >> output.txt  INDEX=$[$INDEX+1]done < ~/Desktop/sample.txtsample.txt123456789Actual Output output.txtNUM[0]=1NUM[1]=2NUM[2]=3NUM[3]=4NUM[4]=5NUM[5]=6NUM[6]=7NUM[7]=8Expected Output output.txtNUM[0]=1NUM[1]=2NUM[2]=3NUM[3]=4NUM[4]=5NUM[5]=6NUM[6]=7NUM[7]=8NUM[8]=9Second QuestionI wanted to improve the script by prompting the user to enter the name for array, location of the text file to import and also the location of where they want the output text file to go. However, it is not liking the ${IMPORT} part and it saying; ./ArrayExport.sh: line 11: ~/Desktop/sample.txt: No such file or directoryBut that file exists, however if I manually enter the location of the file in the ${IMPORT} section it will work fine.ArrayCreator.sh Final ScriptINDEX=0echo -n Enter a name for the array: read $NAMEread -e -p Enter the location of the text file:  IMPORTread -e -p Enter a name for the output including the extension:  EXPORTwhile read LINEdo  echo $NAME[$INDEX]=\$LINE\ >> $EXPORT  INDEX=$[$INDEX+1]done < ${IMPORT}I hope this makes sense, sorry for asking two questions in one post :/ but I hope guys can help, thanks in advance :)
Array Creator Bash OS X not expected output
bash;osx;array