[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] dry run
From: |
Eric Blake |
Subject: |
Re: [Help-bash] dry run |
Date: |
Mon, 19 Nov 2012 07:03:58 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121029 Thunderbird/16.0.2 |
On 11/19/2012 06:16 AM, Robert Durkacz wrote:
> My question is why can't such an option or be provided,
A little thought would show why this will never be implemented. What
would such an option output for the following:
if complex_command; then
foo=command1
else
foo=command2
fi
$foo args
On the line for $foo args, there is no way to know what $foo expands to
unless you have previously executed (not just scanned) the
complex_command. Therefore, there is no way to dry run what the final
results will be without running things, but running things is counter to
the goal of a dry run.
That said, you might be interested in the bashdb project, which uses
bash hooks to provide a debugger interface where you can single-step
through a bash script; it's not the same as telling you what the script
would do, but it at least lets you control how much or little of the
script is actually run.
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature