[rancid] Unable to figure out "end of run not found"

Piegorsch, Weylin William weylin at bu.edu
Tue Jun 18 09:03:06 UTC 2019


> you can even put redirects

That's a neat trick!!!  I'll have to remember that one; thanks!
__

weylin

On 6/17/19, 5:27 PM, "Jean Benoit" <jean at unistra.fr> wrote:

    On Mon, Jun 17, 2019 at 09:05:13PM +0000, Piegorsch, Weylin William wrote:
    > I actually don't use the semicolon.
    > Not sure if this is bash specific, sh specific, or posix general, but
    > without the semicolon it sets the global environment variable only for the
    > duration of that command following the variable definition, and unset it
    > upon returning control to the cli. See also your "export" comment, which
    > has correlating implications regarding environment vs namespace vs scope.
    > But I'm not an experienced programmer, and don't pretend to grok the
    > various nuances, benefits, and pitfalls known by those who actually know
    > what they're doing, so if using the semicolon is better I all ears.
    
    You are right: ; is not necessary.
    
    NOPIPE=yes rancid -d -t type devicename
    
    is is a perfectly valid syntax according to POSIX Shell Grammar Rules.
    It works with bash, dash, ksh, zsh and other shells.
    
    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02 
    see "simple_command" syntax and rule 7, which defines "ASSIGNMENT_WORD".
    
    simple_command   : cmd_prefix cmd_word cmd_suffix
                     | cmd_prefix cmd_word
                     | cmd_prefix
                     | cmd_name cmd_suffix
                     | cmd_name
    
    cmd_prefix       :            io_redirect
                     | cmd_prefix io_redirect
                     |            ASSIGNMENT_WORD
                     | cmd_prefix ASSIGNMENT_WORD
    
    You don't need the ; and you dont need export, and you can even put
    redirects, as long as assignments are before the command.
    Example :
    XYZ=foo </tmp/x >/tmp/y A=1 B=bar mycommand myarg
    
    -- 
    Jean
    



More information about the Rancid-discuss mailing list