[Part 2] Download torrent & newsserver package(s)
|
13th May, 2013, 09:53 AM
Post: #163
|
|||
|
|||
RE: [Part 2] Download torrent & newsserver package(s)
)
it can work, because of shell expansion, expressions, redirects and standard outputs and inputs try Code: { echo "get /index.html\r\n"; sleep 1; } | telnet xbianip 8080 my output Code: (02:00) [media:~] amk$ { printf "get /index.html\r\n"; sleep 2; } | telnet xbian 8080 if the command I sent you is not working, then it must be typo somewhere... I see probably where after sleep 2 must be ";" ant speace, before } ... so I try again: Code: #!/bin/sh and the point how it works is: printf just takes text between " " and puts it on stdout the command inside " " starting with get is nothing else as direct communication to http server. protocols GET and POST. that part after "get " is exactly the same (should be), what you type into address bar of your browser. what we do, we don't send the command via browser, but via telnet. telnet by default listens on stdin for commands. and we do it with Code: printf "text" | telnet and now the interesting part - and we come to the { }. printf opens stdout, sends text "text" and !closes! output. what would make telnet to close as well and therefore terminate the connection. take telnet here like some kind of glasses to other side. so we need to wait few ms or s for the data to be transfered back. so we use sleep. ";" is used to separate commands on one line. normally you do: Code: echo "1"; echo "2"; echo "3" but if you do like this Code: echo "1" ; sleep 2 | telnet so you need something like buffer (accumulate) one buffer from more programs... and then send to telnet. so you can use shells alternation ... or brace expansion is it called, i don't know. it just combines the commands (data) inside try funny things like: Code: echo s,e{x,y} Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here |
|||
« Next Oldest | Next Newest »
|
Possibly Related Threads... | |||||
Thread: | Author | Replies | Views: | Last Post | |
[Part 3] Download torrent & newsserver packages | Fred | 221 | 885,696 |
18th Mar, 2016 03:00 PM Last Post: akitolong |
|
Download Package not installing | naverave | 3 | 13,872 |
16th Mar, 2014 07:56 PM Last Post: mk01 |
|
download package setup | pathia | 5 | 18,846 |
28th Sep, 2013 12:00 AM Last Post: Gemma01 |
|
Download package | enzu1 | 1 | 9,124 |
4th Feb, 2013 10:35 PM Last Post: CurlyMo |