|
From: | Hyunho Cho |
Subject: | bash "extglob" needs to upgrade at least like zsh "kshglob" |
Date: | Fri, 28 Oct 2022 15:44:34 +0900 |
###################################################### Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall uname output: Linux EliteBook 5.19.0-23-generic #24-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 14 15:39:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.2 Patch Level: 2 Release Status: release ###################################################### bash "extglob" almost unusable except with very tiny string. there is no such problems in zsh "kshglob". ------------------------------------------------------------------------------------ # this is just for testing purposes. $ foo=$( gcc -v --help 2> /dev/null | sed -En 's/^\s*(-[^ ]+).*/\1/p' ) # this is a simple work that just removes trailing spaces. ( in bash )$ time res=${foo%%+( )} real 0m10.409s # 10 seconds ! user 0m10.408s sys 0m0.000s ( in zsh )$ setopt kshglob ( in zsh )$ res=${foo%%+( )}" Done immediately. ---------------------------------------------------- ( in bash )$ res=${foo//*( )$'\n'*( )/$'\n'} No hope ( in zsh )$ res=${foo//*( )$'\n'*( )/$'\n'} Done almost immediately.
[Prev in Thread] | Current Thread | [Next in Thread] |