I am writing to a file using simple echo
(I'm open to using other methods).
When writing to a file that already exists, can I make echo prompt the user to overwrite or not?
For eg, maybe an argument like -i
would work?
echo -i "new text" > existing_file.txt
And the desired outcome is to prompt the user to overwrite or not...
echo -i "new text" > existing_file.txt
Do you wish to overwrite 'existing_file.txt'? y or n: