-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tilde ~
sometimes not quoted
#9
Comments
|
Zsh, Fish, dash, oilshell, nushell, PowerShell and probably more |
node, however, does not, i think, if you pass it in child_process.exec? |
const { exec } = require('node:child_process');
exec('echo ~', (error, stdout, stderr) => {
console.log(`exec: ${stdout}`);
});
const { execFile } = require('node:child_process');
execFile('echo', ['~'], {shell: false}, (error, stdout, stderr) => {
console.log(`execFile (shell=false): ${stdout}`);
});
execFile('echo', ['~'], {shell: true}, (error, stdout, stderr) => {
console.log(`execFile (shell=true): ${stdout}`);
}); Unsurprisingly, the output is
|
ahh, the sounds like this would be a useful thing to quote. If we did it automatically, in what ways could that be a breaking change? (the case above where it quotes is because of the spaces, so it's not inconsistent right now) |
Looking at the code, we see that Lines 11 to 14 in da8a3ab
Speaking of introducing breaking changes, you could consider quoting the percent sign |
Right, but the presence of The goal is to not introduce breaking changes, since that's the most harmful thing any package can do to the ecosystem. My question was, if we change it so that |
In many shells, ~ is a shorthand for ${HOME}, and there are other expansion as well ~+N and ~-N expand to directories from the history. The ~ is always quoted at the beginning of a word, or following `=` or `:` Fixes #2 and ljharb#9 Author-Rebase-Consent: https://No-rebase.github.io
In many shells, ~ is a shorthand for ${HOME}, and there are other expansion as well ~+N and ~-N expand to directories from the history. The ~ is always quoted at the beginning of a word, or following `=` or `:` Fixes #4 and ljharb#9 Author-Rebase-Consent: https://No-rebase.github.io
In many shells, ~ is a shorthand for ${HOME}, and there are other expansion as well ~+N and ~-N expand to directories from the history. The ~ is always quoted at the beginning of a word, or following `=` or `:` Fixes #4 and ljharb#9 Author-Rebase-Consent: https://No-rebase.github.io
The treatment of
~
should be consistent at the very least. I find it surprising that~
is not quoted since all other special Bash characters are quoted.I suggest adding
~
to the list of characters to quote in this line:shell-quote/quote.js
Line 14 in da8a3ab
This quirk was showcased last week in a AmateursCTF challenge.
The text was updated successfully, but these errors were encountered: