Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > GURU NEEDED : break a command into several lines and comment each line

Reply
Thread Tools

GURU NEEDED : break a command into several lines and comment each line

 
 
bolega
Guest
Posts: n/a
 
      01-13-2011
Basically, I have spent a few hours experimenting and searching on the
comp.unix.shell

how to break a command with several switches into more than one line
AND to be able to put some comment on each line.

#!/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.

Bolega


 
Reply With Quote
 
 
 
 
Berthold Höllmann
Guest
Posts: n/a
 
      01-13-2011
bolega <(E-Mail Removed)> writes:

> Basically, I have spent a few hours experimenting and searching on the
> comp.unix.shell
>
> how to break a command with several switches into more than one line
> AND to be able to put some comment on each line.
>
> #!/bin/bash -xv
>
> command \ # comment1
> -sw1 \ # comment2
> -sw2 \ # comment3
> arguments


How about

-----------
#!/bin/bash -xv

COMMAND=command # comment1
COMMAND=$COMMAND -sw1 \ # comment2
COMMAND=$COMMAND -sw2 \ # comment3
COMMAND=$COMMAND arguments

$COMMAND
---------
?

Regards
Berthold
> One ought to be able to comment every single switch if desired for
> whatever reason.
>
> Bolega
>
>


--
A: Weil es die Lesbarkeit des Textes verschlechtert.
F: Warum ist TOFU so schlimm?
A: TOFU
F: Was ist das größte Ärgernis im Usenet?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)

iEYEARECAAYFAk0vcpYACgkQcXJNT6Y4fveF1gCgmw41BZEHgy Vzx6gn6HFsS+6W
zBEAn0OyciTF+qNI5tn/ATiOGROw2dW5
=ki9L
-----END PGP SIGNATURE-----
 
Reply With Quote
 
 
 
 
Chris Rebert
Guest
Posts: n/a
 
      01-13-2011
On Thu, Jan 13, 2011 at 1:18 PM, bolega <(E-Mail Removed)> wrote:
> Basically, I have spent a few hours experimenting and searching on the
> comp.unix.shell
>
> how to break a command with several switches into more than one line
> AND to be able to put some comment on each line.
>
> #!/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.


This doesn't seem to have anything whatsoever to do with Python...

Regards,
Chris
 
Reply With Quote
 
David W. Hodgins
Guest
Posts: n/a
 
      01-13-2011
On Thu, 13 Jan 2011 16:18:31 -0500, bolega <(E-Mail Removed)> wrote:

> how to break a command with several switches into more than one line
> AND to be able to put some comment on each line.
> command \ # comment1
> -sw1 \ # comment2


Not what you want to hear, but that will not work. With the above,
the backslash is being used to escape the following space, rather
then a newline, as is required to continue the line. Even if it
were to work that way, would the next line be considered a continuation
of the command, or of the comment?

Your stuck with

command \
-sw1
# comment1
# comment2

Regards, Dave Hodgins

--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      01-14-2011
On Thu, 13 Jan 2011 13:49:06 -0800, Chris Rebert wrote:

> On Thu, Jan 13, 2011 at 1:18 PM, bolega <(E-Mail Removed)> wrote:
>> Basically, I have spent a few hours experimenting and searching on the
>> comp.unix.shell

[...]
> This doesn't seem to have anything whatsoever to do with Python...


Well, I launch Python scripts from the shell, so there's your connection.

*wink*



--
Steven
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read a file line by line and write each line to a file based on the5th byte scad C++ 23 05-17-2009 06:11 PM
Group several lines into one line Dirk Dre Ruby 6 05-01-2009 01:03 AM
IT Job Guru - Certification Guru Rohit A+ Certification 0 08-13-2008 07:31 PM
How to break the lines in printing to html lines? Ciba LO Perl Misc 4 07-08-2006 02:58 AM
Find a line, and comment out the next 5 lines joe shaboo Perl 1 04-20-2004 04:24 AM



Advertisments