How can I get the name of the default output filename from curl using the argument -O?
Using -o one can choose a filename. I want to get the name of the original file, but don't understand how to get it.
curl -o filename http://www.website.com
curl -O http://www.website.com
The only way I know is an insufficient one using the last changed file with the command ls -lat
RudiC
2
Not sure what keeps you from trying what you already have in your post. What be its result? man curl
(linux):
I want to extract the name itself to a variable. The -O option doesn't do that. I can't attach the name to a variable because I don't know it.
I'm not sure if the ls -lat is a good way.
RudiC
4
How about
curl -vO http://www.website.com/index.php |& grep GET
Make sure you specify a remote filename to avoid receiving an error.