[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFE: capture command AND output for display and/or redirection
From: |
Eric Blake |
Subject: |
Re: RFE: capture command AND output for display and/or redirection |
Date: |
Tue, 23 Apr 2013 15:41:04 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 04/23/2013 01:07 PM, todd.dsm@gmail.com wrote:
> Guys, I found the part in the manual about submitting bugs but not requests
> for enhancement. If this is not the right place, let me know.
A missing feature is merely a different form of bug, so yes, this is the
right place.
>
> Enhancement Request:
> Bash could use a standardized method of capturing a command AND its output
> for display in the terminal and/or redirection (to wherever, file, what have
> you).
'set -x' is standardized by POSIX, and portable to more than just bash.
Additionally, the DEBUG trap can provide you bash-specific additional
hooks into logging, at the expense of no longer being standardized.
>
> Is this silly = yes. But, I have 2 words to disable any similar arguments:
> 'government work'. The white collars may never come around to our way of
> thinking, or more appropriately, knowing. Until that happens some goofy
> reporting must be used.
>
> echoing a command, then executing is just duplication; also silly. trap is
> cool, (EG: trap 'printf %s\\n "$BASH_COMMAND" >&2' DEBUG) - but in the case
> of redirection to a file, the variable is first printed literally, then
> expanded; this fails too.
>
> Is there any any relief for those working-class scripters like myself?
Yes, and what you want already exists.
Read this thread for more details:
https://lists.gnu.org/archive/html/help-bash/2013-04/msg00031.html
In particular, that thread points out:
http://mywiki.wooledge.org/BashFAQ/050
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature