Thread: [A-a-p-user] setting variable to output of a program?
Brought to you by:
vimboss
From: Matthew W. O. <mat...@we...> - 2003-03-02 19:12:27
|
I have built a perl script that scans through a directory tree in order to return a space-separated list of source files. How can I set a variable to use this output? I've tried: SRCFILES = :sys $COMPILER -t src -E '(AAPDIR|CVS)' but this doesn't work, nor does: SRCFILES << :sys $COMPILER -t src -E '(AAPDIR|CVS)' Do I need to use a python directive to run a sys command: SRCFILES = `execstatement...` If so, what should this be? Thanks! -- Matthew Weier O'Phinney ma...@we... http://matthew.weierophinney.net |
From: Bram M. <Br...@mo...> - 2003-03-02 20:29:15
|
Matthew Weier O'Phinney wrote: > I have built a perl script that scans through a directory tree in order > to return a space-separated list of source files. How can I set a > variable to use this output? Use the redir_system() function, as explained in the chapter about using Python. Example: @ok, result = redir_system("ls") @if ok: FILES = $result It's a bit strange to use Perl though, why not do something in Python? I have an item on the todo list to make an equivalent for the "find" command: search for files in a directory tree. I suppose this would be useful for you. -- MICHAEL PALIN PLAYED: 1ST SOLDIER WITH A KEEN INTEREST IN BIRDS, DENNIS, MR DUCK (A VILLAGE CARPENTER WHO IS ALMOST KEENER THAN ANYONE ELSE TO BURN WITCHES), THREE-HEADED KNIGHT, SIR GALAHAD, KING OF SWAMP CASTLE, BROTHER MAYNARD'S ROOMATE "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html /// |
From: Matthew W. O. <mat...@we...> - 2003-03-02 21:02:03
|
-- Bram Moolenaar <Br...@mo...> wrote (on Sunday, 02 March 2003, 09:29 PM +0100): > > Matthew Weier O'Phinney wrote: > > > I have built a perl script that scans through a directory tree in order > > to return a space-separated list of source files. How can I set a > > variable to use this output? > > Use the redir_system() function, as explained in the chapter about using > Python. Example: > > @ok, result = redir_system("ls") > @if ok: > FILES = $result Excellent -- this looks good! > It's a bit strange to use Perl though, why not do something in Python? 'Cause I know Perl... ;-) > I have an item on the todo list to make an equivalent for the "find" > command: search for files in a directory tree. I suppose this would be > useful for you. Definitely -- my solution is a personal workaround until you get this working. -- Matthew Weier O'Phinney ma...@we... http://matthew.weierophinney.net |