Skip to content

Handling of \n in CLI arguments #19

@marco-foscato

Description

@marco-foscato

Attempts to use CLI arguments that contain \n result in the backslash being escaped to give \\n which is later not recongnised as a newline character. Instead, the intended result can be achieved by opening a '' (single quotation) or "" (double quotation)block in the command line so that the terminal known we need to close such block and when we hit the return key the newline character will be part of the argument passed to ACC.

So, these do not work, as the atomids argument is parsed as a single line so only the first bond is removed:

autocompchem -t editbonds --infile ../t2-mol.sdf --outfile out2.sdf --atomids '0 1 REMOVE\n1 2 REMOVE'
autocompchem -t editbonds --infile ../t2-mol.sdf --outfile out2.sdf --atomids "0 1 REMOVE\n1 2 REMOVE"

but, this does work:

autocompchem -t editbonds --infile ../t2-mol.sdf --outfile out2.sdf --atomids '0 1 REMOVE
1 2 REMOVE'

autocompchem -t editbonds --infile ../t2-mol.sdf --outfile out2.sdf --atomids "0 1 REMOVE
1 2 REMOVE"

The expected behavior of using \n is unreliable because of the different behaviors of echo creating false expectations.

We can consider forcing the interpretation of the \n char sequence as a newline character in future releases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions