Karaf
  1. Karaf
  2. KARAF-754

shell:cat hyphen ("-") option not activating STDIN.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 3.0.0
    • Component/s: karaf-shell
    • Labels:
      None

      Description

      According to the help for shell:cat, the - is supposed to activate cat for STDIN (just as the Linux cat command does). However, the hyphen is being used as an argument parsing flag and hence isn't working:

      karaf@root> cat --help
      DESCRIPTION
      shell:cat
      Displays the content of a file or URL.

      SYNTAX
      shell:cat [options] paths or urls

      ARGUMENTS
      paths or urls
      A list of file paths or urls to display separated by whitespaces
      (use - for STDIN)

      OPTIONS
      --help Display this help message
      -n The number the output lines, starting at 1.

      karaf@root> shell:cat -
      Error executing command shell:cat undefined option -

      It may be sufficient to remove the STDIN option from the cat command, I'm not sure how useful STDIN is within an OSGi command-line prompt anyway.

        Activity

        Hide
        Christian Schneider added a comment -

        I tested the "-" option by doing
        la | cat -
        This works fine. So the problem with Ctrl-D might be separate from this issue. I will close resolved. Please reopen if the Ctrl-D issue should be solved as part of this.

        Show
        Christian Schneider added a comment - I tested the "-" option by doing la | cat - This works fine. So the problem with Ctrl-D might be separate from this issue. I will close resolved. Please reopen if the Ctrl-D issue should be solved as part of this.
        Hide
        Christian Schneider added a comment -

        I added an option "-" which can be used to express the stdin. The problem is though when I cat from stdin and end the input with Ctrl-D then
        the karaf shell will also exit. Any idea?

        Show
        Christian Schneider added a comment - I added an option "-" which can be used to express the stdin. The problem is though when I cat from stdin and end the input with Ctrl-D then the karaf shell will also exit. Any idea?
        Hide
        Jean-Baptiste Onofré added a comment -

        +1

        We have others commands that use stdin.

        Show
        Jean-Baptiste Onofré added a comment - +1 We have others commands that use stdin.
        Hide
        Glen Mazza added a comment -

        Alternatively, you can perhaps add a --stdin and/or -s option to read from STDIN (ignoring any file URLs given if this setting is used).

        Show
        Glen Mazza added a comment - Alternatively, you can perhaps add a --stdin and/or -s option to read from STDIN (ignoring any file URLs given if this setting is used).
        Hide
        Jean-Baptiste Onofré added a comment -

        It's a "general" issue. If we have an option like "-//" or something like this, we will have the same issue. Let me check if we can improve it in Gogo.

        Show
        Jean-Baptiste Onofré added a comment - It's a "general" issue. If we have an option like "-//" or something like this, we will have the same issue. Let me check if we can improve it in Gogo.

          People

          • Assignee:
            Christian Schneider
            Reporter:
            Glen Mazza
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development