shell step: how to escape double qoutes #253
-
Hi, How one can escape double quotes f.eks. to be able to call a command line path with space? Many thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
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 start with a quote, then you can actually just add the quotes you want to pass in the middle of the string and it's fine (like the last example). As a final note. . . notice the difference between |
Beta Was this translation helpful? Give feedback.
-
moving this to the discussion board - feel free to respond there if you have further questions :-) |
Beta Was this translation helpful? Give feedback.
-
Documentation expanded to show examples for handling spaces in paths & args here: https://pypyr.io/docs/steps/cmd/#spaces-in-paths--args |
Beta Was this translation helpful? Give feedback.
Hi Aleksandar,
Any of the below should work, interchangeably:
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…