Path: csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!usenet.stanford.edu!not-for-mail From: isabella parakiss 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: References: 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 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11623 On 10/11/15, Dan Stromberg 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