• The danger of command line editing (Was: Is 'cd -' to be considered (in

    From Kenny McCormack@21:1/5 to janis_papanagnou+ng@hotmail.com on Sun Oct 30 14:29:11 2022
    In article <tjm0oh$6g1a$1@dont-email.me>,
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    ...
    I've gotten in the habit of doing dd (assuming just a single line in the
    buffer) before exiting (if I don't want anything to be executed).

    Yes, either that, or, (if the typed command will have no bad effects)
    just accept the error message.

    Maybe it should be possible to configure the shell to always ask for confirmation (i.e., an "Are you sure?" prompt) before going ahead after you exit the editor.

    Incidentally, I agree that the best solution would be if vi (which is
    usually vim these days) could return some non-zero exit code in this
    situation. I'll bet that could be done with some fancy vim scripting;
    whether it would be worth the trouble or not is another matter.

    It would be interesting to know if the shell would recognize the non-zero
    exit code and do the right thing. I'll have to test that at some point (in bash).

    --
    I'm building a wall.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Kenny McCormack on Mon Oct 31 01:00:50 2022
    On 30.10.2022 15:29, Kenny McCormack wrote:

    Incidentally, I agree that the best solution would be if vi (which is
    usually vim these days) could return some non-zero exit code in this situation. I'll bet that could be done with some fancy vim scripting; whether it would be worth the trouble or not is another matter.

    The problem I see is that we'd be creating sort of an own ecosystem
    with modified tools and tools relying on such modification.


    It would be interesting to know if the shell would recognize the non-zero exit code and do the right thing. I'll have to test that at some point (in bash).

    I wouldn't expect that shell would react on non-zero status here,
    but please keep us informed, in any case it's interesting to know.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Kenny McCormack on Mon Oct 31 10:50:27 2022
    On 30.10.2022 15:29, Kenny McCormack wrote:

    Incidentally, I agree that the best solution would be if vi (which is
    usually vim these days) could return some non-zero exit code in this situation. I'll bet that could be done with some fancy vim scripting; whether it would be worth the trouble or not is another matter.

    It would be interesting to know if the shell would recognize the non-zero exit code and do the right thing. I'll have to test that at some point (in bash).

    The "Esc v" in Kornshell's vi editing mode is referring to 'fc -e vi'
    and the 'fc' man page says:

    "[...] If the editor returns a non-zero exit status, this will suppress
    the entry into the history list and the command reexecution. [...]"

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)