Multiline shell commands do not work in CMD #247
Taitava
started this conversation in
Debugging and testing
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
On Windows, if the shell is Command Prompt (CMD), and a shell command is split on multiple lines, only the first line is executed.
Example:
Output:
Newline
The newline character used by Obsidian is
\n
. I tried to replace\n
with\r\n
in shell command strings if the shell isCMD
, but that did not change the behavior at all.Possible solutions
&
. It means to execute the next command regardless of if the previous command succeeded or not. I don't like this because it means I'd need to change the semantics of a user's command: a user has defined a multiline shell command, but my code would transform it into a single line shell command, concatenated with&
. I don't even know all possible bad combinations of&
when it's joined together with ends/starts of lines. E.g. if a line already ends with&
, it would become&&
which is a different thing than what was originally meant.Beta Was this translation helpful? Give feedback.
All reactions