Re: OT: BASH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2004-12-05 at 00:15, Alexander Dalloz wrote:
> Am Sa, den 04.12.2004 schrieb Bill Gradwohl um 16:50:
> 
> > Two questions:
> >  Assuming the script is a long running 
> > script, is it safe to modify the script while its executing?
> 
> Your intention sounds a bit "obscure".
Not necessarily, I do have the same issue sometimes (your script is
still calculating and you're already off again coding the next part).
It's safe to do that from my experience, you won't screw your running
process.

> 
> > 2) There seems to be no way to "goto" in BASH. If one has a lengthy 
> > script that fails half way down, the only thing to do appears to be to 
> > wrap the top half in an if that won't execute so as to skip that top 
> > half and get to where the script should again restart. Is there a better 
> > way to do this?
> 
> Operate with "debug" code like echo lines of states of used variables
> and with exit instructions / codes. This will catch part 1) of your
> question too. Make use of functions.

A function's contents are supposed to be defined by the functionality of
that block, not by the coder's debugging needs at a certain point of
development... In C I am also a heavy user of #ifdef XXX / #endif for
quick debugging purposes. You may consider the "here document" to
comment out parts:
http://www.tldp.org/LDP/abs/html/here-docs.html#HEREDOCREF

(Tnx Alexander, didn't have that handy before ;-) ).

-- 
HaJo Schatz <hajo@xxxxxxxx>
http://www.HaJo.Net

PGP-Key:  http://www.hajo.net/hajonet/keys/pgpkey_hajo.txt


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux