help-gnu-emacs
[Top][All Lists]
Advanced

[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: Oleksandr Gavenko
Subject: Re: GURU NEEDED : break a command into several lines and comment each line
Date: Fri, 14 Jan 2011 10:07:28 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

On 13.01.2011 23:18, bolega 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 is offtopic for this list.

But seems POSIX shell do not support inline comments.

You can use such trick (: is NOP command, but `` invoke shell, so consume CPU resource):

  $ printarg -x `: this opt allow x` \
  -y `: this opt allow y` \
  -z `: this opt allow z`
"printarg"
"-x"
"-y"
"-z"

I put comments before command like (example from Makefile):

# /O1  creates small code
# /Oi-  disable generate intrinsic functions (to save exe size)
# /Oy  omit frame pointer
# /Gm-  disable minimal rebuild
OPTIM_CFLAGS =  /O1 /Oi- /Oy /Gm-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]