Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   Double quotes, single quotes (http://www.linux-archive.org/debian-user/653945-double-quotes-single-quotes.html)

Dr Beco 04-08-2012 04:34 PM

Double quotes, single quotes
 
Dear deb users,
I can't seem to find the correct combination of quotes to run this command:
$vi +"r ! find . -name 'error*' -printf '%f
'" themain.c

Is there a way to achieve this (using bash)?
Thanks!Beco
--
Dr. Beco
A.I. research, Cognitive Scientist and Philosopher

Linux Counter #201942

Bob Proulx 04-08-2012 11:40 PM

Double quotes, single quotes
 
Dr Beco wrote:
> I can't seem to find the correct combination of quotes to run this command:
>
> $vi +"r ! find . -name 'error*' -printf '%f
'" themain.c
>
> Is there a way to achieve this (using bash)?

The problem you are hitting is that vim is expanding the % itself and
isn't passing it to bash nor on to find. It isn't related to quoting.
It is related to vi's percent expansion. Use something other than
percent to avoid the problem. In vi the '%' is replaced by the
current filename. That is traditional vi behavior.

For 'find' you can use the default -print case by not specifying anything.

vim +"r ! find . -name 'error*'" themain.c

Bob


All times are GMT. The time now is 12:14 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.