#!/usr/bin/env bash
exec 3<>/dev/tcp/ysap.daveeddy.com/80
lines=(
'GET / HTTP/1.1'
'Host: baidu.com'
'Connection: close'
''
)
printf '%s\r\n' "${lines[@]}" >&3
while read -r data <&3; do
echo "got server data: $data"
done
exec 3>&-
来源