help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: methods and scripts


From: Chris Edillon
Subject: Re: methods and scripts
Date: Thu, 15 Apr 2004 20:04:09 -0400 (GMT+4)

On Thu, 15 Apr 2004, John Sechrest wrote:

>  % shellcommands:
>  % 
>  %     debian_unstable_mta.!debian_unstable_mta_postfix_user::
>  % 
>  %         "/bin/sed 's/^ *//' <<'            EOF' | EDITOR=ed vipw
>  %             /^\+/
>  %             -
>  %             a
>  %             postfix:x:1000:1000::/var/spool/postfix:/bin/false
>  %             .
>  %             w
>  %             q
>  %             EOF"
>
> Can you explain the specifics of which " does what?
> 
> I am seeing mis-matched quotes, so I am clearly not understanding something...
> 
  i imagine it's something like this (correct me if i'm wrong
brendan).  the double-quotes before /bin/sed and after the
last EOF contain the string which encompasses the shellcommand.
the first set of single quotes contains the sed substitution
command which tells sed to strip all leading whitespace from
its input.  its input begins is a here document bounded by
the string '            EOF', where the single-quotes are
telling it to use all of the whitespace before EOF as part
of the end point of the here document (that's what allows
him to indent the EOF in with the rest of the commands to
make it look clean instead of sticking it at the beginning
of a line where it looks out of place).  the output of the
sed command is piped into vipw, using ed as its editor instead
of vi.  and of course the here document contains all of the
ed commands used to edit the passwd file.

chris





reply via email to

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