Beta

BASH commands: head

Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • FArekkusu Avatar

    A negative integer value x means that all the lines but the last x should be printed

    Then why should the whole input string be returned when char_count/line_count is <= abs(x)?

  • FArekkusu Avatar

    Tests generate warnings.

  • FArekkusu Avatar

    Unused parameter should be removed.

  • FArekkusu Avatar

    Tests shouldn't log anything.

  • user9644768 Avatar
    • Logs messages(atleast in sample tests) are displayed at the end.
    • It is not specified what to do incase of n + number_of_lines <= 0 and c + strlen(argv[2]) <= 0
    • user9644768 Avatar

      and here's what I mean by "displayed at the end":

       should_pass_all_the_tests_provided
      Test Passed
      Test Passed
      Test Passed
      Test Passed
      Test Passed
      Test Passed
      $ head -n -42
      Text: "I have thought of homes put up -
      And blown away.
      "
      Expected: "I have thought of homes put up -
      And blown away.
      "
      Actual: ""
      Completed in 2.1726ms
      Log
      The "head" utility
      -   with the "-n" flag
      -     and a zero value
      -       separated by whitespace
      -         returns an empty string
      The "head" utility
      -   with the "-n" flag
      -     and a zero value
      -       not separated by whitespace
      -         returns an empty string
      The "head" utility
      -   with the "-n" flag
      -     and a positive value
      -       greater than the number of lines in the source string
      -         separated by whitespace
      -           returns the entire source string
      The "head" utility
      -   with the "-n" flag
      -     and a positive value
      -       greater than the number of lines in the source string
      -         not separated by whitespace
      -           returns the entire source string
      The "head" utility
      -   with the "-n" flag
      -     and a positive value
      -       less than or equal to the number of lines in the source string
      -         separated by whitespace
      -           returns a string with "x" lines
      The "head" utility
      -   with the "-n" flag
      -     and a positive value
      -       less than or equal to the number of lines in the source string
      -         not separated by whitespace
      -           returns a string with "x" lines
      The "head" utility
      -   with the "-n" flag
      -     and a negative value
      -       greater than the number of lines in the source string
      -         separated by whitespace
      -           returns the entire source string
      
    • user9644768 Avatar

      Edit: n + number_of_lines <= 0 and c + strlen(argv[2]) <= 0 integer_value + number_of_lines <= 0 and integer_value + strlen(argv[1]) <= 0