Re: BASH

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

 



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@xxxxxxx
http://www.ycc.com
spamSTOMPER Protected email


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

  Powered by Linux