Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

comment block curiosity



Emboldened by Bart's showing how fundamental syntax might be aliased, and knowing how dangerous that might be, yet I thought I'd play with that.  I've always thought we should have block comments and of course you can fake it very well with:

   : <<COMMENTBLOCK

   foo
   bar
   baz

   COMMENTBLOCK

... But I thought I'd try to alias that because I keep forgetting the " : << " syntax.  So:

   alias startcomment=': <<COMMENTBLOCK'
   alias endcomment='COMMENTBLOCK'

   echo about to start a comment:

   startcomment        # This actually works believe it or not.

   foo
   bar
   baz

   endcomment         # This is ignored, it doesn't work but no error
   either.
   COMMENTBLOCK       # This ends the comment.

   echo back to working code.


You'd think that "endcomment' would be the alias more likely to work but it it doesn't.  Why?  Can it be fixed?






Messages sorted by: Reverse Date, Date, Thread, Author