[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Strange behaviour of read builtin
From: |
M. Nejat AYDIN |
Subject: |
Strange behaviour of read builtin |
Date: |
Wed, 1 Jul 2020 07:51:00 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 |
When a variable name is supplied to the read builtin, leading and
trailing white spaces are stripped from the input:
read line <<< " x "; echo "[$line]"
outputs
[x]
as expected.
If no names are supplied then leading and trailing white spaces are
preserved:
read <<< " x "; echo "[$REPLY]"
outputs
[ x ]
Is this intended behaviour of read builtin? If so where is it
documented? The Bash Reference Manual says only "If no names
are supplied, the line read is assigned to the variable REPLY."
There is no mention of preserving leading and trailing white
spaces.
- Strange behaviour of read builtin,
M. Nejat AYDIN <=
- Re: Strange behaviour of read builtin, Greg Wooledge, 2020/07/01
- Re: Strange behaviour of read builtin, Eli Schwartz, 2020/07/01
- Re: Strange behaviour of read builtin, M. Nejat AYDIN, 2020/07/01
- Re: Strange behaviour of read builtin, Greg Wooledge, 2020/07/02
- Re: Strange behaviour of read builtin, M. Nejat AYDIN, 2020/07/02
- Re: Strange behaviour of read builtin, Chet Ramey, 2020/07/02
- Re: Strange behaviour of read builtin, Eli Schwartz, 2020/07/02
- Re: Strange behaviour of read builtin, Chet Ramey, 2020/07/02
- Re: Strange behaviour of read builtin, M. Nejat AYDIN, 2020/07/02
- Re: Strange behaviour of read builtin, Chet Ramey, 2020/07/02