简体   繁体   English

如何在npm脚本中执行以下bash语句?

[英]How to execute the following bash statement in npm script?

I know there are many ways to do this, but I'm using the 'npm scripts' as my build tool. 我知道有很多方法可以做到这一点,但是我正在使用“ npm脚本”作为构建工具。 I'm stuck on this simple echo statement that will source my .bash_plugin into the .bash_profile: 我被困在这个简单的echo语句中,它将我的.bash_plugin source到.bash_profile中:

  "scripts": {
    "info": "echo 'npm as a build tool'",
    "installBashPlugin": "echo 'source ~/.bash_plugins/.my_plugin' >> '~/.bash_profile'"

What am I doing wrong here? 我在这里做错了什么? I get the following error: 我收到以下错误:

npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the buildtool@1.0.0 bash script 'echo 'source ~/.bash_plugins/.my_plugin' >> '~/.bash_profile''.

Oh sh*t I got this. 哦,我明白了。

"scripts": {
    "info": "echo 'npm as a build tool'",
    "installBashPlugin": "echo 'source ~/.bash_plugins/.my_plugin' >> ~/.bash_profile"

Those single quotes around the target file: .bash_profile is where it errored out. 目标文件: .bash_profile周围的那些单引号引起了错误。 Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM