Andrew Lentvorski wrote:
> Ralph Shumaker wrote:
> 
>> Piquing my curiosity, "a small non-negative integer" is "small" up to
>> what?  :)  IOW, what is the limit?
> 
> That's obvious: -127.
> 
> Now, why is that obvious?  And why isn't it -128?
> 

I guess you're trying to say it must be a signed char, but I don't think
that's correct. Perhaps that was once true, but it seems one can use
anything up to the ulimit file setting, nowadays.

Here's cute little script that demos bash using /dev/tcp

- - -
#!/bin/bash

shopt -o -s nounset

declare LINE
declare -rx SCRIPT=${0##*/}

printf "Connecting to host\n"
exec 1023<> /dev/tcp/www.google.com/80

printf "Sending request to host\n"
printf "%s HTTP/1.0\r\n" "GET /supported_domains" >&1023
printf "Accept: text/html, text/plain\r\n" >&1023
printf "Accept-Language: en\r\n" >&1023
printf "User-Agent: %s (Bash Script)\r\n" "$SCRIPT" >&1023
printf "\r\n" >&1023

printf "Receiving page\n"
printf "%s\n" "----------------"
while read LINE <&1023 ; do
        printf "%s\n" "$LINE"
done

exit 0
- - -

Regards
..jim


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to