in bash programming, want read 10 bytes, not return when meeting '\n'
know in bash 4.x, there -n option fulfill feature:
#!/bin/bash exec 6<>/dev/tcp/localhost/6666 read -r -n 10 -u 6
but how implementated when no -n options provided: such bash 3.x version?
in advance!
example bash 3.2:
$ echo $bash_version 3.2.25(1)-release $ cat file 0123 4567 89ab cdef $ read -r -n 8 -d $'\0' var < file $ echo "$var" 0123 456 $
Comments
Post a Comment