Cannot use pipe symbol in my .bowerrc scripts

Here is mine .bowerrc:

{
  "directory": "vendor/assets/bower",
  "scripts": {
    "postinstall": "find ./vendor/assets/bower -name '*.html' -print0 | xargs -0 sed -i '' -E -e 's/href=\"https?:\\/\\//href=\"\\/\\//g'"
  }
}

It is intended to replace all instances href="https://with href="//. I did this to fix a bug with my build system.

I get this error:

bower postinstall   find ./vendor/assets/bower -name '*.html' -print0 | xargs -0 sed -i '' -E -e 's/href="https?:\/\//href="\/\//g'
bower postinstall   find: [object Object]: unknown primary or operator
bower ECMDERR       Failed to execute "find ./vendor/assets/bower -name *.html -print0 [object Object] xargs -0 sed -i  -E -e s/href="https?:\/\//href="\/\//g", exit code of #1 find: [object Object]: unknown primary or operator

Additional error details:
find: [object Object]: unknown primary or operator

Why is the pipe symbol converted to [object Object]? How to make a command run?

I tried adding a hidden forward slash before |:

"postinstall": "find ./vendor/assets/bower -name '*.html' -print0 \\| xargs -0 sed -i '' -E -e 's/href=\"https?:\\/\\//href=\"\\/\\//g'"

Now I get:

bower ECMDERR       Failed to execute "find ./vendor/assets/bower -name *.html -print0 | xargs -0 sed -i  -E -e s/href="https?:\/\//href="\/\//g", exit code of #1 find: |: unknown primary or operator

I'm on OSX 10.10.5

+4
source share
1 answer

, Bower . . , , , gulp postInstall. , -, .

, bash script, bash script. 'postInstall.sh' perms, .bowerrc, postInstall 'postInstall: ./postInstall.sh'

0

Source: https://habr.com/ru/post/1618954/


All Articles