Uploaded image for project: 'Commons Exec'
  1. Commons Exec
  2. EXEC-83

Arguments with spaces lead to quotes in arguments in bash

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.2
    • None
    • None
    • Java 7 & OSX

    Description

      If I run my script directly from a bash prompt I see a different behavior than if I launch with commons-exec. This may be the nature of the beast (java Runtime-exec interacting with bash), but leads me to have to rewrite scripts to remove extraneous quotes.

      Here is my script:
      $ cat ./foo.sh
      #!/bin/bash
      echo "$@"

      case I: commons-exec with no spaces ==> arguments do NOT have quotes when in bash script

      cmdLine=[/opt/bmam/bin/avidcommand/write_xmp_remote.sh, 70059021, RAW-one_two_three, http://foo.com]
      output (of $@):
      70059021 RAW-one_two_three http://foo.com

      case II: commons-exec with spaces ==> arguments have quotes when in bash script

      cmdLine=[/opt/bin/foo.sh, 70058269, "AIR-one two three", http://foo.com]
      output (of $@):
      70058269 "AIR-one two three" http://foo.com

      case III: execute directly from bash ==> arguments do NOT have quotes when in bash script

      $./foo.sh 70058891 "one two three" http://foo.com
      output (of $@):
      70058891 one two three http://foo.com

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            kbrowncnn Kevin Brown

            Dates

              Created:
              Updated:

              Slack

                Issue deployment