Quantcast
Channel: d0wn
Viewing all articles
Browse latest Browse all 73

bash : Put the source of a webpage in a variable

$
0
0

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 :

 var=$(wget -qO- http://server.com/file.htm)

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.

 


Viewing all articles
Browse latest Browse all 73

Trending Articles