AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Wget to stdout12/23/2023 ![]() Why does wget -O- 'url' output to stdout There is no such expression -O- in man wget. It helped me launch a career as a programmer / Oracle. I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. so that gives me a GitHub HTML page which I can parse for the first ( -m 1) reference to a 64bit deb package. Option -O file is used to have wget output to a specific file. I'm actually using the Windoze port at the moment, and this is all i get in -help: -O -output-documentFILE write documents to FILE.This can be done using the -o (lower-case) command line option. gnuzip extracts whatever it gets from standard input, and writes the extracted content to standard output, this time to the pipe connecting to dd. You can use -O /dev/stdout, so downloaded file content will be written to stdout. If you want to use wget, you can use -O option, that speicify file to save. To avoid this, you can replace wget command with curl. The option -O- writes to standard output, in this case to the pipe connecting to gunzip. When you use wget to run cronjob, it create lot of files. ![]() ![]() If you want, you can also redirect the messages/information wget produces on stdout to a log file. If you ran the command as is, wget didn't save anything anywhere. How to redirect your wget output to a log file. Note that recursive retrieving will be limited to the maximum depth level, default is 5. For example, if you need to download pdf files from a website. As a particular use case, if we use as the file, it directs the content to stdout. However, we can use the output-document (-O) option to redirect the content to a file of our choice. This is done with the Recursive Download. The wget command outputs the document content in a separate file by default. the inner wget uses the -qO- option to redirect downloaded output to stdout so I can handle it directly by piping, without writing to any file on disk. wget -O file-name URL Here is an example screenshot: 4. The -A option allows us to tell the wget command to download specific file types.Answering myself, I found out that GitHub keeps a tag called latest so here’s a clever (if I may say so) bash thing to get the latest Hugo for Ubuntu 64bit: wget `wget -qO- | grep -oE -m 1 ''\/gohugoio\/hugo\/releases\/download\/v+.+\/hugo_+.+_b'` In the following example, wget will quietly ( flag -q) download and output the latest WordPress version to stdout ( flag -O -) and pipe it to the tar utility, which will extract the archive to the /var/www directory.
0 Comments
Read More
Leave a Reply. |