Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11623
| Path | csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail |
|---|---|
| From | isabella parakiss <izaberina@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: trap DEBUG and $_ |
| Date | Mon, 12 Oct 2015 07:24:00 +0200 |
| Lines | 26 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.120.1444627443.7904.bug-bash@gnu.org> (permalink) |
| References | <CAEf4Emd6m+JZd3ECqYknU-P3Nz25zyNw+4-BG-0TKy+Fa1hFOg@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 1444627444 27999 208.118.235.17 (12 Oct 2015 05:24:04 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org |
| To | Dan Stromberg <dstromberglists@gmail.com> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=cmlb1uB3KTXKNwnXXbixKN6YLmRNqFE0FwFmeY70STI=; b=Aga4DGzXBWtcIeH1/XzLnQouxsdMp3vw1cBrGWSp15BdzqrpYJf4b5diUqGUvp8LBS YFUbWdsMB8h8DCLQSs4rfCAYduguuSNcFGo6cKfZHBQmOJ61khSF5wDDlNwXkkiibMI0 uWoDdcyW8sBS9MRp4Ri7KoefcX55HXh+pkPNZEq5ZmP6Me5O4SXMezdem8lycuibJid1 8Cd5A+Uvl4IsgT3CNC/Hcloxv/TIQGsPHoFEmOnjE/Rpuhpq8Tn3lRyh6pfcN7y9DCGo WBEDlBca2O06YP7wYVQfnpB7qffS5uI3IHFDfquz0LkrzLm8QoIlMQRAjq0YvD4RkHZe IjWA== |
| X-Received | by 10.50.73.137 with SMTP id l9mr10408873igv.85.1444627440562; Sun, 11 Oct 2015 22:24:00 -0700 (PDT) |
| In-Reply-To | <CAEf4Emd6m+JZd3ECqYknU-P3Nz25zyNw+4-BG-0TKy+Fa1hFOg@mail.gmail.com> |
| X-detected-operating-system | by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). |
| X-Received-From | 2607:f8b0:4001:c05::22f |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.14 |
| 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 | <http://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> |
| Xref | csiph.com gnu.bash.bug:11623 |
Show key headers only | View raw
On 10/11/15, Dan Stromberg <dstromberglists@gmail.com> wrote:
> Is there a way of outputting a datestamp to shell stderr at the _beginning_
> of the execution of a command, that won't wipe out $_?
>
> I use $_ quite a bit for the last argument to the previous command,
> interactively. And I'd like to datestamp all my commands. Datestamping
> after with $PS1 is easy, but datestamping before is a little harder.
>
> I've tried using:
>
> function preexec { if tty -s; then echo "$(tput smso)cmd started $(date
> +%Y\ %a\ %b\ %d\ %r)$(tput rmso)"; fi; }
> trap preexec DEBUG
>
> ...but as you might suspect, I'm finding that $_ is always "preexec" with
> this enabled.
>
> Any suggestions?
>
> Thanks!
>
trap '__=$_; preexec; : "$__"' DEBUG
---
xoxo iza
Back to gnu.bash.bug | Previous | Next | Find similar
Re: trap DEBUG and $_ isabella parakiss <izaberina@gmail.com> - 2015-10-12 07:24 +0200
csiph-web