Taitava/obsidian-shellcommands

CMD: With multiline commands, only the first line is executed

Opened this issue · 5 comments

Example command:

echo "First line"
echo "Second line"
echo "Third line"

OInly the first line is echoed. Then again, this works:

echo "First line" & echo "Second line" & echo "Third line"

I posted a question about this on Stack Overflow: https://stackoverflow.com/questions/74836080/node-js-child-process-exec-with-cmd-exe-only-the-first-line-is-executed

I'm not even certain if this is a bug of SC. I tried to make sure CMD is passed CRLF newlines instead of LF newlines, but even that did not work. I'll keep this marked as a bug for now, but might change it later.

If no solution will be found for this, I'll probably just add a warning text to the textarea of every CMD shell command telling that newlines do not work.

I added this to 0.19.0 because it will also have #297 which touches the same parts of code as this issue.

Hi, I have a related question, I think. I'm trying to run
xdotool key ctrl+a & xdotool key ctrl+c & xdotool key ctrl+g, but I don't think it's working. Ctrl+g here is the quote word count that I was trying to get going the other day, and in order to count ALL words in a longer note it needs to be cached or something via Ctrl+A (select all), Ctrl+C (Copy).

If I just run Ctrl+g in ShellCommands, the pop up from this custom quote counter plugin comes up. But Ctrl+A on its own does not work. Just trying to streamline this process.

Any ideas? Thanks :)

Hi @ReaderGuy42, this issue does not actually relate to your problem, as this is about Window's CMD.EXE, and you seem to be using Bash. So the multiline problem described in this issue should not affect you.

In order to keep this issue related to its actual topic, I replied to your question in the earlier discussion you started, although my answer is not very helpful. But we can continue discussion there and try to find a solution. 👍

I added this to 0.19.0 because it will also have #297 which touches the same parts of code as this issue.

I'm confused why I did put this issue to milestone 0.19.0. This is not released in 0.19.0 and I don't know if I'll ever find a fix for this issue.