如何自动将curl输出写入新文件 [英] how to automatically write curl output to a new file
问题描述
我正在使用 cURL
通过Yahoo Finance API将股票信息检索回到Mac上的终端窗口.
I am using cURL
to retrieve stock information back to the terminal window on my Mac using the yahoo finance api.
即我输入:
curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1'
并打印输出(在本例中为命令行中的最后交易价格)
and it prints the output (in this instance the last trade price in the command line)
它的效果很棒,但是我想知道如何在不执行原始cURL命令的情况下进行任何手动干预的情况下,将此输出自动写入位于我的桌面上的stock.txt文件中.
It works terrific, but I would like to know how to get this output automatically written to a stock.txt file located on my desktop without any manual intervention upon the execution of the original cURL command.
因此,在键入包含股票行情自动收录器的curl查询后,我得到了写在终端窗口和txt文件中的值.
Thus after I type the curl query that contains the stock ticker, I get the value written in the terminal window and the txt file.
推荐答案
尝试一下:
curl -s'http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1'>〜/Desktop/stock.txt&&更多〜/Desktop/stock.txt
这篇关于如何自动将curl输出写入新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!