On 03/06/2017 12:20 AM, ToddAndMargo wrote:
qx{ echo $Str | xclip -selection primary };

passes syntax, but hangs when run

Hi All,

I figured it out.  The reason the above "hangs" is
because it is "ambiguous".   What is Perl and what is
bash are not tightly delineated.  Is "$Str" the
name of a variable in the Bash shell or is it
resolved from Perl?  Is the pipe part of Perl or
part of Bash?  And while we are at it, who sees
the quotes?  And on and on and so forth.  It is
pull you hair out time.  You could "probably" eventually
figure it all out, but you would be complete bald
by the end.

But, not to fret.  To remove the "ambiguity", form the
shell command in a single variable first, then hand
the single variable to "shell".

For example:

sub WriteSecondaryClipboard ( $Str ) {     # <ctrl><c>
   my $Cmd = "echo \"$Str\" | xclip -selection clipboard";
   shell $Cmd;

problem solved.

Thank you all for all the help and tips.  I hope this helps
someone else.


Computers are like air conditioners.
They malfunction when you open windows

Reply via email to