[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read -d'' -n1
From: |
Greg Wooledge |
Subject: |
Re: read -d'' -n1 |
Date: |
Thu, 12 Aug 2010 08:19:57 -0400 |
User-agent: |
Mutt/1.4.2.3i |
> On Thu, Aug 12, 2010 at 1:46 PM, Jan Schampera <jan.schampera@web.de> wrote:
> >> while read -d'' -n1 ch; do
On Thu, Aug 12, 2010 at 01:50:34PM +0800, Sharuzzaman Ahmat Raslan wrote:
> Which part is the mistake, and what is the solution?
If you want the argument of -d to be an empty string, you have to separate
the empty string argument from the -d with some whitespace:
read -d '' -n1 ch
Otherwise, -d'' is exactly the same as -d (the '' goes away entirely),
and read tries to use the -n1 as the argument of -d. Since -d only
takes a single character, the - becomes the delimiter.