echo test >& "quote'test"
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection uname output: Linux xps 6.5.12-100.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Nov 20 22:28:44 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-redhat-linux-gnu Bash Version: 5.2 Patch Level: 21 Release Status: release Description: Running echo test >& "quote'test" should create the file "quote'test", but it creates "quotetest" instead. Repeat-By: echo test >& "quote'test"
Re: echo test >& "quote'test"
On Tue, Apr 09, 2024 at 01:37:08AM +, squeaky wrote: > Bash Version: 5.2 Patch Level: 21 Release Status: release > > Description: > > Running > echo test >& "quote'test" > should create the file "quote'test", but it creates "quotetest" > instead. I can confirm this all the way back to bash 2.05b, and only with the >& redirection operator. Not with &> or > or >> .
Re: echo test >& "quote'test"
On 4/8/24 9:37 PM, squeaky wrote: Bash Version: 5.2 Patch Level: 21 Release Status: release Description: Running echo test >& "quote'test" should create the file "quote'test", but it creates "quotetest" instead. Repeat-By: echo test >& "quote'test" Thanks for the report. This is specific to this form of redirection. The issue is that the WORD following the >& is expanded multiple times, since it has to be expanded once to determine whether it's a number, filename, `-', or empty. Once it's expanded, and known to be a filename, it shouldn't be expanded again. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/