bash : Put the source of a webpage in a variable

When you do some bash scripting , this is often useful to get data from  webserver because they are a very simple way to exchange data from computer from computer.
to put the data that’s available on a webserver into a $var you just have to use the command :

this will fetch the data from http://server.com/file.htm in a non verbose way and put it in variable named var .

you can now do whatever you want with that $var , like greping it for example.

 

Leave a Comment

Your email address will not be published. Required fields are marked *