bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

read -d'' -n1


From: Jan Schampera
Subject: read -d'' -n1
Date: Thu, 12 Aug 2010 07:31:45 +0200
User-agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100329)

Hello,

don't ask about the detail how I originally invented this code, but I stepped over something I really can't explain:


1) Why doesn't this print anything

while read -d'' -n1 ch; do
  echo "$ch"
done <<< $'hello\nworld'


2) Why does this print something, but only up to the hyphen?

while read -d'' -n1 ch; do
  echo "$ch"
done <<< $'hello\nwor-ld'



Verified on 2.04, 3.2.39, 4.1, so I wonder if I have a misunderstanding here.

J.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]