[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GURU NEEDED : break a command into several lines and comment each li
From: |
Pascal J. Bourguignon |
Subject: |
Re: GURU NEEDED : break a command into several lines and comment each line |
Date: |
Fri, 14 Jan 2011 18:41:30 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
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 {}.
- GURU NEEDED : break a command into several lines and comment each line, bolega, 2011/01/13
- Re: GURU NEEDED : break a command into several lines and comment each line, suvayu ali, 2011/01/13
- Re: GURU NEEDED : break a command into several lines and comment each line, Pascal J. Bourguignon, 2011/01/13
- Re: GURU NEEDED : break a command into several lines and comment each line, Stefan Monnier, 2011/01/13
- Re: GURU NEEDED : break a command into several lines and comment each line, Berthold Höllmann, 2011/01/14
- Re: GURU NEEDED : break a command into several lines and comment each line, David W. Hodgins, 2011/01/14