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

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

Re: What's wrong with this code??


From: Frédéric Perrin
Subject: Re: What's wrong with this code??
Date: Wed, 08 Dec 2010 15:08:45 -0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Santanu <thisissantanu@gmail.com> writes:
> On May 18, 2:20 am, Andreas Politz <poli...@fh-trier.de> wrote:
>> Santanu <thisissant...@gmail.com> writes:
>> > Can you tell me what is wrong with this code:
>> > -------------------
>> > (setq
>> >    go-packages-installed
>> >    (split-string
>> >     (shell-command-to-string
>> >      "cd $GOROOT/src/pkg && find . -iname *.go | sed -e 's|^\./||g; s|/
>> > [^/]*\.go||g' | sort | uniq"\
>> > )))
>>
>> You have to escape the backslash characters, because of string
>> expansion.
>
> BTW, can you also explain a bit what it means when I don't put the
> double backslash character, and instead use a single backslash? I
> ask this because my original code (the incorrect one above) did
> produce some correct results.

The first expression in the sed was « s|^./||g; » (which didn't hurt,
because it seems that you don't have directories whoose name contains
only a single letter), and the second wes « s|/[^/]*.go||g », with the
LHS matching strings such as « /svgo ».

-- 
Fred


reply via email to

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