bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

semicolon not added to history items when final line of compound list en


From: Grisha Levit
Subject: semicolon not added to history items when final line of compound list ends with a comment
Date: Tue, 28 Feb 2017 12:41:43 -0500

Usually a multi-line command gets added to the history list with
semicolons added in the requisite places, i.e:

    $ f() {
    > :
    > }
    $ fc -ln -1
    f() { :; }

However, if the final line is a comment, the semicolon is not added,
making the history item an invalid command:

    $ f() {
    > :
    > #
    > }
    $ fc -ln -1
    f() { : }

Similarly, if the final line is a command which ends in a comment, the
comment character is preserved as part of the command, again making
the resulting history item invalid:

    $ f() {
    > : #
    > }
    $ fc -ln -1
    f() { : #; }

Same is true for `for' and `while' loops, `if` and `select' statements, etc.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]