all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: GURU NEEDED : break a command into several lines and comment each line
Date: Fri, 14 Jan 2011 18:41:30 +0100	[thread overview]
Message-ID: <877he78jsl.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: b6837579-c757-41be-bbb5-33a91849d962@c39g2000yqi.googlegroups.com

bolega <gnuist006@gmail.com> writes:

> On Jan 13, 7:12 pm, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
>> > #!/bin/bash -xv
>> > command       \ # comment1
>> >          -sw1 \ # comment2
>> >          -sw2 \ # comment3
>> >          arguments
>> > One ought to be able to comment every single switch if desired for
>> > whatever reason.
>>
>> Thanks for the riddle.  Here's a solution:
>>
>>   command        $(: # comment1
>>   )        -sw1  $(: # comment2
>>   )        -sw2  $(: # comment3
>>   )        arguments
>>
>> -- Stefan
>
> thanks to all four of you who replied and solved this problem to a
> large extent, building on each other's ideas.
>
> I would have done it by the first method of concatenating or pipes
> into a sed which replaced end by the next and # can be placed after
> pipes. the string then fed into a bash.
>
> Stefan, whats the purpose of the colon ? it works without colon also.
> Is it subshell or some environment import ? like the colon which can
> substitute the #!/bin/bash on the top ?

The colon is a built-in command equivalent to true.


The syntax specified for $( ... ) (in man bash) is:

       $(command)

so a command is expected.  The shortest command doing nothing is :.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


  reply	other threads:[~2011-01-14 17:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bfd24856-94a9-4b46-b0b7-8c142f5b87f5@z5g2000yqb.googlegroups.com>
2011-01-13 21:45 ` GURU NEEDED : break a command into several lines and comment each line Berthold Höllmann
2011-01-13 22:08 ` David W. Hodgins
2011-01-13 22:46 ` suvayu ali
2011-01-13 22:47 ` Pascal J. Bourguignon
2011-01-14  3:12 ` Stefan Monnier
     [not found] ` <jwvaaj4b2sb.fsf-monnier+gnu.emacs.help@gnu.org>
2011-01-14  6:28   ` bolega
2011-01-14 17:41     ` Pascal J. Bourguignon [this message]
2011-01-13 21:18 bolega
2011-01-14  8:07 ` Oleksandr Gavenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877he78jsl.fsf@kuiper.lan.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.