Table of contents

bash

%3 cluster_11380731_d635_4a0f_8d4b_6ea94576c5db bash _91d92b14_ac37_4f48_8287_e30d3adac501 Example based guide to mastering GNU awk _8bca4e78_ff5a_495b_af9f_4554360e9646 Basic Scripting with Awk and Gnuplot _f9502e9b_c174_4c96_8532_d6359763fb0c Bash associative array examples _d37bfead_682d_444a_85dd_897fb3bd861d When did I run that command? Update your Bash prompt with command start time _8238f2e2_8a83_4e74_9728_317c96aa66ad Exit codes _72dd4399_374d_4ac8_8365_a36b50c8d4bb Makefile _72dd4399_374d_4ac8_8365_a36b50c8d4bb->__0:cluster_11380731_d635_4a0f_8d4b_6ea94576c5db _8b320e27_af14_443a_9ee7_81d0890e9772 VT100 codes _5356b564_e99d_451c_a410_10c7074b8200 Recurring commands _5356b564_e99d_451c_a410_10c7074b8200->__1:cluster_11380731_d635_4a0f_8d4b_6ea94576c5db _ca63792f_3a1b_42e6_8509_be36db77c307 JQ illustrated _ca63792f_3a1b_42e6_8509_be36db77c307->__2:cluster_11380731_d635_4a0f_8d4b_6ea94576c5db __3:cluster_11380731_d635_4a0f_8d4b_6ea94576c5db->_8b320e27_af14_443a_9ee7_81d0890e9772

When did I run that command? Update your Bash prompt with command start time

post

# How does it work?

First the `PS1` prompt is printed in the terminal and it waits for a command.
Once a command is typed and `Enter` is pressed, `PS0` is expanded. This runs the
`move_cursor_to_start_of_ps1` function. This function moves the cursor to the
beginning of the first line of the `PS1` prompt, overwrites the string `--:--`
with the current time, then returns the cursor to its earlier position. Then the
command executes.