failing: attempt to embed perl in bash (sh)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

failing: attempt to embed perl in bash (sh)

L. A. Walsh
Have tried several variations for the SingleQuoted(SQ)
  perl -e 'xxxx'
or just
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.

I have this snippet in my test file:


# path goes from curdir (topdir) through file repomd.xml

for path in "${paths[@]}"; do
  my dir=${path%/*}
  my repo=${dir#tumbleweed/repo/}
  array names=()
  my p_prog='use strict; use warnings; use P;
    my $dir = $ARGV[0];
    while (<>) {
      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")
# 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
    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

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 [hidden email].
For more options, visit