Alexander Nasonov's shared items

Wednesday, September 16, 2009

Multiline comments in shell with here-document

Did you know that you can use multiple lines in shell with the ":" command and a here-document? The following example is inspired by two scripts from SHELLdorado:
: <<!
if ! file .; then wc `echo *`; fi
! df | tail
wc $(echo *)
!
If '<<!' doesn't work, you can switch to '<<SOMETHING_UNIQUE'.

No comments:

Post a Comment