Skip to content

tail should support "+" correctly #984

@nfischer

Description

@nfischer

Node version (or tell us if you're using electron or some other framework):

all

ShellJS version (the most recent version/Github branch you see the bug on):

master

Operating system:

all

Description of the bug:

shell.tail doesn't support +<num> correctly. While it's true negative numbers should be treated the same as sign-less numbers (ex. tail -n -10 means "print last 10 lines of file"), numbers with a + sign mean to print that numbered line and all lines following. So tail -n +2 file.txt means "print all lines except the first line."

Example ShellJS command to reproduce the error:

$ shx tail -n +10 file_with_11_lines.txt
2
3
4
5
6
7
8
9
10
11

$ tail -n +10 file_with_11_lines.txt
10
11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bash compatCompatibility issues with bash or POSIX behaviorfixBug/defect, or a fix for such a problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions