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

Re: BASH



Sean wrote:

:2,450s/^/#/

And then afterward remove the comments with:

:2,450s/^#//

Not pretty, but maybe good for what you need?



As you said - not pretty, but I'll keep it in my arsenal.
Thanks.

I guess this is where old DOS and the much hated "goto" offered something beneficial. Adding a label to a line of code and then issuing a goto to that label at the top of the script is better than the alternatives. The label can be left in the code as it does no harm and even acts as a bit of documentation. Removing or commenting the goto at the top is obvious. Therefore only a one line change can undo this.

Your commenting suggestion can be dangerous as you'd have to remember the range to undo it later. The if structure I've used is also inferior as it requires you to comment or get rid of both the "if" and the "fi" statements requiring 2 lines be changed.

I wish there were an alternative.

--
Bill Gradwohl
bill ycc com
http://www.ycc.com
spamSTOMPER Protected email


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