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 in combination > w

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

2024-11-26 Thread Chet Ramey
On 11/26/24 6:01 PM, Evan Gates wrote: 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 comm

Re: doc-strings of the 'command' built-in, as output by help

2024-11-26 Thread Chet Ramey
On 11/26/24 1:39 PM, Andrew Davis wrote: -vFor each COMMAND, print a string to indicate how it would be interpreted by the shell. The command word is printed for shell functions, built-ins, and keywords, while a pathname is printed for executables found in PATH. Aliases are printed with th

Re: String substitution bug

2024-11-26 Thread Zachary Santer
On Mon, Nov 25, 2024 at 9:48 PM Martin D Kealey wrote: > > On Mon, 25 Nov 2024 at 22:22, Zachary Santer wrote: >> >> People can write bad code in any language. > > Yeah, that includes English, apparently. > > The problem is that the Shell makes it hard to write good code and easy to > write bad

Re: doc-strings of the 'command' built-in, as output by help

2024-11-26 Thread Andrew Davis
On Mon, Nov 25, 2024 at 9:04 PM Martin D Kealey wrote: > > For both ‘command -v’ and ‘command -V’, there are no combinations of > options for ‘type’ that will produce the same output in all cases. > For executables, aliases, functions, built-ins, and keywords, the output of `command -V` (capital

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

2024-11-26 Thread Koichi Murase
Isn't this achievable with PS0 and Bash-5.3 valsub? _prompt_time() { if [[ $_prompt_time_start ]]; then _prompt_time=$((${EPOCHREALTIME//[!0-9]}-_prompt_time_start)) _prompt_time_start= fi printf -v REPLY '%d.%06d' "$((_prompt_time/100))" "$((_prompt_time%100))" } PS0+='${| _

Re: String substitution bug

2024-11-26 Thread Wiley Young
Writing's more difficult than reading, and writing can be expensive. Synoptic reading, traditionally, is considered the "highest form" of reading (according to "How to Read a Book") (Hate mail to them, please, not me.). Writing from some definable point of view is inevitable. It might be worthwhi

Re: String substitution bug

2024-11-26 Thread Mike Jonkmans
On Tue, Nov 26, 2024 at 12:47:48PM +1000, Martin D Kealey wrote: ... > The problem is that the Shell makes it hard to write good code and easy to > write bad code. > > (“No programmer would ever be lazy.” Yeah, right. I ran a tutorial on Bash > at the 2015 LCA in Auckland, and was abashed (pun in