相关疑难解决方法(0)

shell脚本是否对编码和行结尾敏感?

我正在Mac上制作NW.js应用程序,并希望通过双击图标以开发模式运行应用程序.第一步,我正在尝试使我的shell脚本工作.

在Windows上使用VSCode(我想获得时间),我run-nw在项目的根目录创建了一个文件,其中包含:

#!/bin/bash

cd "src"
npm install

cd ..
./tools/nwjs-sdk-v0.17.3-osx-x64/nwjs.app/Contents/MacOS/nwjs "src" &
Run Code Online (Sandbox Code Playgroud)

但我得到这个输出:

$ sh ./run-nw

: command not found  
: No such file or directory  
: command not found  
: No such file or directory  

Usage: npm <command>

where <command> is one of:  (snip commands list)

(snip npm help)

npm@3.10.3 /usr/local/lib/node_modules/npm  
: command not found  
: No such file or directory  
: command not found
Run Code Online (Sandbox Code Playgroud)

我真的不明白:

  • 似乎它需要空行作为命令.在我的编辑器(VSCode)我试图替换\r\n\n(以防\r造成了问题),但它改变不了什么.
  • 它似乎找不到文件夹(有或没有dirname指令),或者它可能不知道cd …

bash shell sh

37
推荐指数
4
解决办法
1万
查看次数

如何在OS X上使用curl将文件下载到新创建的目录?

我正在尝试将我的Heroku备份下载到文件夹中.

下载到这样的当前文件夹工作:

curl -o latest.dump `heroku pg:backups public-url`
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试添加一个folders路径时,latest.dump它看起来像这样:

$ curl -o /db-bkups/latest.dump `heroku pg:backups public-url`
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0 44318    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0Warning: Failed to create the file 
Warning: /db-bkups/latest.dump: No such file 
Warning: or directory
 36 44318   36 16384    0     0   9626      0  0:00:04  0:00:01  0:00:03  9626
curl: (23) Failed writing body …
Run Code Online (Sandbox Code Playgroud)

macos bash curl heroku

10
推荐指数
1
解决办法
2308
查看次数

标签 统计

bash ×2

curl ×1

heroku ×1

macos ×1

sh ×1

shell ×1