如何使用CURL附加现有文件?

问题描述 投票:8回答:2

我在网上搜索过但找不到任何有用的东西。使用CURL,我想将内容附加到已经存在并命名为test.pls的文件中。任何人都可以告诉我如何使用curl做到这一点。我试过的命令是

curl http://192.99.8.170:8098/stream --output test.pls

curl -K --output test.pls http://192.99.8.170:8098/stream

curl -a  --output test.pls http://192.99.8.170:8098/stream

但以上所有开始从头开始创建文件。他们不保留文件的初始内容任何人都可以帮助我!

shell curl append
2个回答
15
投票

使用shell的附加输出重定向(>>)而不是curl的--output选项。

curl http://192.99.8.170:8098/stream >> test.pls

2
投票

更简单,更清洁的方法如下

curl -sS https://address.to.file.txt >> file-name.txt

© www.soinside.com 2019 - 2024. All rights reserved.