[PATCH] glob: add shopt globmtimesort to sort globs by mtime

2022-10-03 Thread Evan Gates
--- There is currently no good way to sort files by mtime in the shell. It's possible to do so with an ls that supports -t, but parsing ls is problematic. It's possible using GNU find's printf %T and nul separated lists with sort -z. Neither is a great option. This patch adds the ability to sor

Re: [PATCH] glob: add shopt globmtimesort to sort globs by mtime

2022-11-16 Thread Evan Gates
On Mon Nov 14, 2022 at 1:00 PM MST, Chet Ramey wrote: > On 10/3/22 2:56 PM, Evan Gates wrote: > > --- > > > > There is currently no good way to sort files by mtime in the shell. > > It's possible to do so with an ls that supports -t, but parsing ls is > >

Bug using ] as index when declaring associative array

2013-10-23 Thread Evan Gates
I recently tried to use ] as an index in an associative array. While it works fine after the array is declared, I could not figure out a way to include it in the initial declaration. To reproduce: declare -A aarr aarr[\]]=rbrac declare -p aarr # this should print a legal declaration for aarr eval

IFS in function call in herestring for read

2014-03-12 Thread Evan Gates
setup: foo() { printf "%q\n" "$IFS" >&2; printf "%s\n" "$*" >&2; } IFS=: read <<< "$(foo bar baz qux)" bash 4.2 output: : bar:baz:qux bash 4.3 output: : bar baz qux IFS is still set within the function call, but isn't being used in the expansion of "$*" -emg

Re: Does [ -f FILE ] have a bug on testing a symlink ?

2015-02-09 Thread Evan Gates
from bash(1): Unless otherwise specified, primaries that operate on files follow symbolic links and operate on the target of the link, rather than the link itself. On Mon, Feb 9, 2015 at 1:00 PM, Cheng Rk wrote: > > > To bug-bash@gnu.org: > > > According this documentation `help test`, I am expe

Usage of __P vs PARAMS in histfile.c

2015-04-08 Thread Evan Gates
he devel branch HEAD. -emg From 4d533ebe10316dbb511088ecc92a4978ad3f0ad5 Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Wed, 8 Apr 2015 08:17:11 -0700 Subject: [PATCH] change __P to PARAMS in histfile.c as far as I can tell histfile.c indirectly includes rlstdc.h not stdc.h both define similar ma

Re: logic in m4/strtoimax.m4 inverted

2024-05-14 Thread Evan Gates
On Mon, Oct 3, 2022 at 12:48 PM Chet Ramey wrote: > > On 10/1/22 6:38 AM, Emanuel Haupt wrote: > > Static build of 5.2 fails to build on FreeBSD 13.1-RELEASE (amd64). > > > > The logic in m4/strtoimax.m4 is inverted. The following patch replaces > > strtoimax() if and only if it is present and fun

[PATCH] prompt: add \m, PROMPTTIMEFORMAT, shopt prompt_time_all

2024-09-16 Thread Evan Gates
Expand \m in prompts according to PROMPTTIMEFORMAT for the last timed command. This is an easy way to get the result of time without redirections by using @P expansions. Add shopt prompt_time_all to time every command run. Used in combination with \m the time of the previous command can be added

Re: [PATCH] prompt: add \m, PROMPTTIMEFORMAT, shopt prompt_time_all

2024-11-26 Thread Evan Gates
Quoting Evan Gates (2024-09-16 19:03:21) > Expand \m in prompts according to PROMPTTIMEFORMAT for the last > timed command. This is an easy way to get the result of time without > redirections by using @P expansions. > > Add shopt prompt_time_all to time every command run. Used