I am trying to create a file which is manually created by opening a vi editor then Esc + i and then you paste a column of entries to it and then Esc :wq!, I don't want user to even open vi editor, the script should as to enter list of data and it should create the file and add the entries to it.
count=1
read total
while [ "$count" -le "$total" ]; do read -p Name ; echo $Name > /tmp/cl; count=$(($count + 1)); done
But it doesn't work as it expects an Enter after each input which is not there when I paste an output at the first "Name" prompt, moreover I don't want to even enter the total no of names.