#!/bin/bash

E_NOFILE=666
if [ -f "lorem.txt" ]
then
	file=( ` cat "lorem.txt" `)
else
	echo "File does not exist"
	exit $E_NOFILE
fi

read -p "Please enter the start location: " OFF
OFFSET=$((OFF - 1 )) #since first word is #0
echo ${file[@]:$OFFSET:1}

#echo ${file[@]}   # Will print the whole file array

#This will echo 5 words , offset  0. (like php substr)
#echo ${file[@]:0:5}

#for word in ${file[@]}
#do
#	echo  $word
#done
exit 0

