New example that can get you colors on the web
[oneliner/.git] / README.md
1 # oneliner
2 This is an example of a nice netcat one line server (Mostly just to show how cool pipes can be)
3 ## How to use
4
5 You just need to do a script that we will call `test.sh`
6
7 ```bash
8 #!/bin/bash
9 echo "************PRINT SOME TEXT***************\n"
10 echo "Hello World!!!"
11 echo "\n"
12 echo "Resources:"
13 echo "\n"
14 echo "Addresses:"
15 echo "$(ifconfig)"
16 echo "\n"
17
18 ```
19 And then while in the same folder you run the one line server:
20 ```bash
21 while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; sh test.sh; } | nc -l 1234 -q 1; done &
22 ```
23
24 ### Consider changing
25 + `test.sh` is the script that we will run and take its output 
26 + `1234` is the port that we will use.
27 + `-q 1` is the timeout value, change it if your script is slow
28 + pretty much everything else should remain immutable.
29
30 ## Conclusion!!!
31
32 **So thats it!!!** Thanks for ~joining my ted talk....I mean,~ reading my README.md
33
34 # PS
35
36 **YES, I KNOW THERE ARE MORE THAN ONE LINE BECAUSE OF MY TEST.SH**, but that is not a part of the server, just the data.