hi! thanks for your help but your solution did not quite solve the problem so I'll try to explain it better! If you type this command directly in the shell:
paste - file (where 'file' is a text file you have somewhere!)
you will see that you will be prompt for some input and for every line you'll type, the shell will output the content of your file one line at the time. To exit you will have to press CTRL+C, otherwise you'll remain in the paste interactive mode.
What i am trying to achieve is this same thing but in a more friendly interactive way, so that the user will be prompt for filename and input and the two things will be merged together, one line at the time, (and not appended at the end of the file as you suggest) and eventually saved in a new file if the user wants to. My problem is that I dont know how to tell the shell when to stop so i know how i can make my user enter the 'paste' modality but dont know how to stop the process. So let's say i have a file "names" which contains
John
Nora
Andrew
Maybe the user wants to merge these names with some input like numbers or scores:
so he/she will type:
1
and the programme will answer with
1 John
then:
2
2 Nora
finally:
3
3 Andrew
and now that we are at the end of the file 'names', I want to exit and maybe to save this new merged file in a new file!
Hope my explanation makes it easier to understand. Any solution? thanks, stef