Re: Proposing debugging aid in scripts
On Sat, Jan 08, 2000 at 08:19:56PM +0100, Christian Hammers wrote:
> Hello
>
> Since I begun using debconf I had very much problems because my scripts
> suddenly were completely silent as I removed all the nice "echo"
> commands that before told me what was going on.
>
> To solve this problem (verbose for me, no output for users), I started
> inserting the following line in all my postinst/preinst etc. scripts:
>
> $DEBIAN_SCRIPT_DEBUG || set -v -x
>
> This helped me very much. Does anybody has similar tricks, too ?
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]
then
echo=echo
else
echo=:
fi
Then use $echo everywhere.
Alternatively, use something like:
if ...; then echo(){ command echo "$@"; } ; else echo(){ } ; fi
and then use echo normally from then on.
Julian
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Julian Gilbey, Dept of Maths, QMW, Univ. of London. J.D.Gilbey@qmw.ac.uk
Debian GNU/Linux Developer, see http://www.debian.org/~jdg
Donate free food to the world's hungry: see http://www.thehungersite.com/
Reply to: