Have tried several variations for the SingleQuoted(SQ)
script...including
  perl -e 'xxxx'
or just 
  '#!/usr/bin/perl
on the 1st line, but nothing seems to work.
I probably have scores, of shell scripts that use this
type of construct.  Some are called by putting the prog
in a "var" 1st, others, I've done inline...  but getting
that syntax, is a bit challenging...(sigh)...
Any ideas?  Files of interest (using vim7.4) below.
Thanks!
-linda
I have this snippet in my test file:
---/tmp/perl_in_bash
#!/bin/bash
# path goes from curdir (topdir) through file repomd.xml
for path in "${paths[@]}"; do
  my dir=${path%/*}
  my repo=${dir#tumbleweed/repo/}
  repo=${repo%%/*}
  array names=()
  my p_prog='use strict; use warnings; use P;
    my $dir = $ARGV[0];
    while (<>) {
      chomp;
      if ( m{<location href=\"repodata/([^"]+)\"/>} ) {
        my $file=$1;
        unless ($file =~ m{-susedata\.[^.]+\.xml\.gz$} ) {
          P "%s/%s", "$dir", $file;
        }
      }
    }'
  P "dir=%s, repo=%s", "$dir" "$repo"
  readarray -t names< <(perl -e "$p_prog" "$dir" "$path")
  raw_repomd_files[$repo]="${names[*]}"
done
# vim: ts=2 sw=2 et ai number
------------
and I have a perlembeded vim-syntax file like this:
--- perlembed.vim ---
" in ~/.vim/after/syntax/sh as perlembed.vim
    if exists("b:current_syntax")
      unlet b:current_syntax
    endif
    syn include @PerlScript syntax/perl.vim
    syn region PerlScriptCode matchgroup=PerlCommand start=+[=\\]\@<!'+ 
skip=+\\'+ end=+'+ contains=@PerlScript contained
    syn region PerlScriptEmbedded matchgroup=PerlCommand 
start=+\<perl\>+ skip=+\\$+ end=+[=\\]\@<!'+me=e-1 
contains=@shIdList,@shExprList2 nextgroup=PerlScriptCode
    syn cluster shCommandSubList add=PerlScriptEmbedded
    hi def link PerlCommand Type
------
-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
--- 
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Monday, November 26, 2018
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment