Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15574

Re: [FR] save command times and exit status in history automatically

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Daniel Colascione <dancol@google.com>
Newsgroups gnu.bash.bug
Subject Re: [FR] save command times and exit status in history automatically
Date Thu, 7 Nov 2019 12:18:07 -0800
Lines 31
Approved bug-bash@gnu.org
Message-ID <mailman.849.1573157938.13325.bug-bash@gnu.org> (permalink)
References <CAKOZuevfhS7veH9+GSc=8StpgrA_vy59Y2fYYGhMDk0OPZb69Q@mail.gmail.com> <8e19b0fc-4183-90fa-b067-9da636998d6f@case.edu> <CAKOZuevFuqrQhH75_-Dpum2VwmUkrP1r7E6b--v=Mg_EVHWuCw@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1573157938 9614 209.51.188.17 (7 Nov 2019 20:18:58 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "bash.bug list" <bug-bash@gnu.org>
To Chester Ramey <chet.ramey@case.edu>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+HUo3gXnlUxhcE/adYkQb9P9YQC/S6wrd75PKHajDgE=; b=k5rfzUaWJAjgb1txA4i20l2S01XkCxmfNuN5FCEg31Egew/l9hyBeEIPEerR2q18XC nYQyn+32WLOtquVLJ2YPJ7SYyKG0dJPp+I4nCu/ZufKaWpuNq870zEJ3fpbgAUpW6L05 Fc6rOA7zg/iENhS+cvazzHPsianlO2pJ6A4wQGT6Be4gm3XaCVixbjC7rieCbPbV3drS 6Q6ExiGJwxd2O+mJliznNJFDPKCHRRBmfRDyPvVtLld+9fEpNSKGGy1vFYDHk6SnnIdA JVTcQYbBh8om/MOBNIsNaapBCglYuW/A6iRcTDcDAn7R0Mbm1Ov4Hk8Y1+k79NKdjB1k VtQg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+HUo3gXnlUxhcE/adYkQb9P9YQC/S6wrd75PKHajDgE=; b=uC5EBFPWp6ff3Pjzh8ba1qwNdwzykoPZ7e10WqbuXESj7YIo4UlHk5jmKMji4Ro+/d 1w6g+8Z2AaTdYwEyKat99zQP39Yx5+a+JV/uEh6l7WfIkv4uwdLyBeEtDl4aQDbCtI6o h1gHn3MwErpZQqaPeZFo7B9KDiceTGSgS0twnPCtZLYiJxY6SJixqACPf07shG893i5c bfQcb864t1IaefePAyRRgynsKZUmo1ogiFmnvmQpiHF8p7JOPyTxO9z9W/m1fiF2ciyy fQurQ+6/qdOnQfg0YG8KAB9GVojLdkAguCs6+VaNUJAK9jWjjhUt7ZFQlY+DKiDrOSr6 M9pA==
X-Gm-Message-State APjAAAUVrYhLhI8UhI5hKj8U4YO7y4sLjHjFt+QtLZBDRlFXFFbEVqra l2uQIrhNlVG4rd2CLrcXyoyZll4yv2DEdzsVvhYOYg==
X-Google-Smtp-Source APXvYqwHYvxNZvuXDqLu98/Dez3/ceMQ0acSAZPBjrE8+VJtgvyiem1Qr/5k3seVGpvPcxEEO3Yfo2+94e2IiyLtTPI=
X-Received by 2002:a2e:9216:: with SMTP id k22mr3937089ljg.157.1573157923991; Thu, 07 Nov 2019 12:18:43 -0800 (PST)
In-Reply-To <8e19b0fc-4183-90fa-b067-9da636998d6f@case.edu>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2a00:1450:4864:20::241
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAKOZuevFuqrQhH75_-Dpum2VwmUkrP1r7E6b--v=Mg_EVHWuCw@mail.gmail.com>
X-Mailman-Original-References <CAKOZuevfhS7veH9+GSc=8StpgrA_vy59Y2fYYGhMDk0OPZb69Q@mail.gmail.com> <8e19b0fc-4183-90fa-b067-9da636998d6f@case.edu>
Xref csiph.com gnu.bash.bug:15574

Show key headers only | View raw


On Thu, Nov 7, 2019 at 12:09 PM Chet Ramey <chet.ramey@case.edu> wrote:
>
> On 11/5/19 12:49 PM, Daniel Colascione wrote:
> > Right now, bash history saves only the command line actually executed.
>
> This isn't quite the case. What it saves is the line returned from
> readline, before it's expanded or executed.

Fair enough.

> > Why not also, optionally, save command execution times and exit
> > statuses? This information is practically free to collect.
>
> Because by the time you gather this information, the command has already
> been saved completely.
>
> There have been various proposals to extend the timestamp with additional
> information, but it's all data you can gather when the timestamp is saved
> before the command is executed.

That's how history works today, yes. I'm wondering whether it'd be
possible to maintain an auxiliary history that included not only the
command lines read, but also their execution time and outcome. Doing
something in PROMPT_COMMAND doesn't seem quite accurate. Maybe what I
really want is something like $?, but instead of containing exit
status, it would contain information from a struct rusage (derived
from wait4) for the last command. Or something like that anyway. The
larger point is that the shell could gather this information
proactively almost for free and I don't think user code running in
existing shell extension points can do the same job.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: [FR] save command times and exit status in history automatically Daniel Colascione <dancol@google.com> - 2019-11-07 12:18 -0800

csiph-web