1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

curlで -bash: -o: command not found

Posted at

curlコマンドにはファイル保存する-oオプションがありますが、urlに&があるとshellのバックグラウンドプロセス実行として解釈されてしまい意図通りに動かない。(バックグラウンド処理されるだけなので標準出力に結果は表示される)

動かない例
$ curl https://www.googleapis.com/books/v1/volumes?q=search+%E6%8A%80%E8%A1%93&maxResults=10 -o result.json
[1] 2950
-bash: -o: command not found

&をエスケープするかurlをクォーテーションで囲むことで解決できる

動く例
$ curl "https://www.googleapis.com/books/v1/volumes?q=search+%E6%8A%80%E8%A1%93&maxResults=10" -o result.json
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?