-
Notifications
You must be signed in to change notification settings - Fork 45
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
sed: no files given #169
Comments
Same issue but not my variant #165 |
This looks like a dupe of #165. Single quotes don't work the same on Windows. Please ping this thread if I've misunderstood. |
@nfischer No, I'm searching text contains single quotes. |
At a glance, your code looks like it should work in that case (although I'm not sure if Which OS did you try this on? |
@nfischer Yeah, I'm trying on Windows. Tried simple change |
I think you need to escape the # Failing to escape quotes in unix sed would fail like so:
sed -i "s/'vue'/'https://cccdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.esm.browser.js'/g" dist/*.js
sed: -e expression #1, char 17: unknown option to `s' You should escape the characters with a "" in the commandline like so: # Escape '/' characters so sed doesn't treat them specially anymore:
shx sed -i "s/'vue'/'https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.10\/dist\/vue.esm.browser.js'/g" dist/*.js
# The same is necessary for unix sed:
sed -i "s/'vue'/'https:\/\/cdn.jsdelivr.net\/npm\/vue@2.6.10\/dist\/vue.esm.browser.js'/g" dist/*.js To use this in a {
"scripts": {
"resolvevue": "shx sed -i \"s/'vue'/'https:\\/\\/cdn.jsdelivr.net\\/npm\\/vue@2.6.10\\/dist\\/vue.esm.browser.js'/g\" dist/*.js"
}
} |
Updating labels. I don't think this is Win-specific, and it's clear this is not really a duplicate of issue #165 despite the similar error message. |
Yes! This (in package.json) works:
@nfischer Please, add this to documentation. |
No change to logic, only docs. This documents the special sed syntax (ex. `shx sed s/foo/bar/g filename.txt`). With that, this mentions that `/` is a special character, so the user must escape that if it's present in either the regex or replacement string. This also documents how Windows handles single quotes differently, so it's desirable to avoid single quotes in package.json scripts. This part isn't specific to sed, but since it's popular to quote sed expressions, I'm adding this to the docs at the same time. Fixes #165 Fixes #169
No change to logic, only docs. This documents the special sed syntax (ex. `shx sed s/foo/bar/g filename.txt`). With that, this mentions that `/` is a special character, so the user must escape that if it's present in either the regex or replacement string. This also documents how Windows handles single quotes differently, so it's desirable to avoid single quotes in package.json scripts. This part isn't specific to sed, but since it's popular to quote sed expressions, I'm adding this to the docs at the same time. Fixes #165 Fixes #169
can't
npm run resolvevue
package.json:
The text was updated successfully, but these errors were encountered: