Skip to content

shell step: how to escape double qoutes #253

Answered by yaythomas
kontramind asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Aleksandar,

Any of the below should work, interchangeably:

  - name: pypyr.steps.shell
    in:
      cmd: '"dir with space/file with space"'
  
  - name: pypyr.steps.shell
    in:
      cmd: '"dir with space"/"file with space"'

  - name: pypyr.steps.cmd
    in:
      cmd: ./"dir with space"/"file with space"

To explain what's going on here a bit more. . . To add the outside "extra" quote really is just because if the string starts with a quote as the first character, yaml thinks this is a structural marking to indicate the start of a string. If you want to pass "extra" quotes to the underlying value you then put these inside the outside "yaml" quotes.

If the string value does NOT star…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by yaythomas
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kontramind
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #252 on January 24, 2022 14:29.