bug-bash
[Top][All Lists]
Advanced

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

String substitution bug


From: marcel.plch
Subject: String substitution bug
Date: Sun, 24 Nov 2024 00:11:02 +0000

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt 
-fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security   
      -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer 
-mno-omit-leaf-frame-pointer -g 
-ffile-prefix-map=/build/bash/src=/usr/src/debug/bash -flto=auto 
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin' 
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc' 
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout' -DNON_INTERACTIVE_LOGIN_SHELLS
uname output: Linux psappho 6.11.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 17 Nov 
2024 16:06:17 +0000 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.2
Patch Level: 37
Release Status: release

Description:

I am trying to do some file management in bash and I have strings in this 
format:

1 dir/hello.txt
2 dir2/bar.jpg

When I run this substitution:
${FOO/[:space:]*/Hello}
I get this result:
1 dir/hHello

The goal is to substitute everything after the first space (including the 
space) with Hello

Seems like a bug to me. In such a case, please confirm and
I will help to investigate

Repeat-By:
Run this shell script:

FOO="1 dir/hello.txt"
echo ${FOO/[:space:]*/Hello}

Thank you for your time
--
Dormouse

Attachment: publickey - marcel.plch@proton.me - 0x1094A451.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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