diff --git a/bopher-ng.sh b/bopher-ng.sh index 24c9991..7c1c67e 100755 --- a/bopher-ng.sh +++ b/bopher-ng.sh @@ -66,14 +66,14 @@ trap clear_term INT # fetch any Gopher resource gophetch() { # args: host, port, selector[, input] - exec 3<>/dev/tcp/$1/$2 # bind the descriptor 3 to a /dev/tcp pseudo-device + exec 4<>/dev/tcp/$1/$2 # bind the descriptor 3 to a /dev/tcp pseudo-device if [[ -z "$4" ]]; then - printf '%s\r\n' "$3" >&3 # send the selector string (printf is more reliable) + printf '%s\r\n' "$3" >&4 # send the selector string (printf is more reliable) else - printf '%s\t%s\r\n' "$3" "$4" >&3 # send the selector + tab + input string + printf '%s\t%s\r\n' "$3" "$4" >&4 # send the selector + tab + input string fi - cat <&3 # fetch and output the result (we have to use cat as the result may be binary) - exec 3<&- # close the descriptor to make it reusable + cat <&4 # fetch and output the result (we have to use cat as the result may be binary) + exec 4<&- # close the descriptor to make it reusable } # parse a single Gophermap line according to the current host and port