Can I print out a code to STDOUT that would mimic the behavior of Ctrl+c inside cat
? E.g. I would like my script to print out the cat
command followed by the content of the file like this:
cat > /my/file/name.txt
I want this line in the filename above
and this one
and this one as well but I want to exit cat in the next line
Ctrl+c somehow
The behavior I want is for the user to copy the lines above, then paste them in a terminal window, and without any more typing, have a name.txt
file with the three lines of content, saved, and be back to the interactive terminal prompt.
Any ideas?