#
#Write a script to display all words of a file in ascending order. 
#

clear

echo -n "Enter name of the file :"
read filename



if [ ! -f $filename ]
then
    echo "File does not exist"
else
	for i in $(cat $filename)
	do
		echo $i >> "tempfile"
	done
	echo "===== SORTED WORDS OF FILES ====="
	echo "$(sort "tempfile")"
	echo "================================="
fi

if [ -f "tempfile" ]
then
	rm "tempfile"
fi