View previous topic :: View next topic |
Author |
Message |
Gentree Watchman
Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Tue May 05, 2015 9:28 am Post subject: how to break out of nano? |
|
|
Hi,
I have nano configured for autosave on exit but if I open a file to which I don't have write access it will happily make changes to the text that it can't save.
When I go to save or exit it shows a permissions error with a continue / cancel choice. That leaves me back in the editor with unsaved changes.
The only way out of this seems to be to close the terminal from which nano was run or use a separate terminal to kill that process.
Is there a clean way, from within nano, to tell it to abandon changes and quit anyway?
I can't find one.
TIA, Gentree. _________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Tue May 05, 2015 11:33 am Post subject: |
|
|
I don't recall if this is standard, but nano here has Ctl-X bound to exit (Close the current file buffer / Exit from nano). When I edit a file that I lack permissions to write, and Ctl-X, nano asks ...
Code: | Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? |
... To which I answer "n" and nano quits. |
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Tue May 05, 2015 11:45 am Post subject: |
|
|
I just noticed that you have autosave on exit. I don't. I tried `nano -t` and got the same result you did. Was able to exit by saving the changed file in a temporary place, just prepended "/tmp/" and got out. Beats killing the nano process, but isn't as graceful as one might like. |
|
Back to top |
|
|
Gentree Watchman
Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Tue May 05, 2015 12:00 pm Post subject: |
|
|
yes, thanks, at least it's a work around. I just wondered whether I was missing a command key or something. Maybe not. _________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Tue May 05, 2015 1:53 pm Post subject: |
|
|
I didn't care for writing the modified but not save-able file out to disk, and found out that changing the filename to /dev/null allows nano to dutifully bail out. |
|
Back to top |
|
|
Gentree Watchman
Joined: 01 Jul 2003 Posts: 5350 Location: France, Old Europe
|
Posted: Tue May 05, 2015 2:32 pm Post subject: |
|
|
/dev/null
smart.Thx _________________ Linux, because I'd rather own a free OS than steal one that's not worth paying for.
Gentoo because I'm a masochist
AthlonXP-M on A7N8X. Portage ~x86 |
|
Back to top |
|
|
|