[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: read -n is confused by \
From: |
Chris F.A. Johnson |
Subject: |
Re: Fwd: read -n is confused by \ |
Date: |
Fri, 27 Jan 2006 03:26:13 -0500 (EST) |
On Thu, 26 Jan 2006, Brett Kail wrote:
Hello,
This is a resend of a message I sent back in May since I never
received a reply to that message.
[....]
Description:
If the nth character of read -n is a \, then bash reads one too
many characters.
Repeat-By:
echo 'abc\abc' | (read -n 4; echo $REPLY)
This is fixed in 3.1,
Additionally, the documentation for 'read' is unclear what happens for
\ when -r is not specified in that it does not distinguish between
"maximum number of characters read" and "maximum number of characters
read into the variable".
Presumably, without -r, the backslash is not considered a
character, it is an escape mechanism.
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)