You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I might be wrong but I think this feature is a bashism, not part of the standard POSIX shell. Note that the default shell is /bin/sh on Unix-like systems (see documentation), so you might want to specify a different one (probably the result of command -v bash).
Anyway, I don't think this is a Node.js bug, exec is passing the string given straight to the shell, so there's nothing we can do here. Generally one would prefer to stick to POSIX-compliant shell code to ensure the code works everywhere, but if you are not concerned about distributability my suggested code should do just fine.
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always?
What is the expected behavior?
(there's no newline when using
printf
, that's why the$
is at the end instead of on the next line)What do you see instead?
$ node /tmp/above_code_snippet.js "$hello" $
Additional information
ANSI strings in bash are documented here https://www.gnu.org/software/bash/manual/bash.html#ANSI_002dC-Quoting and work like this:
See also yargs/yargs-parser#346
The text was updated successfully, but these errors were encountered: