Sponsored Content
Top Forums UNIX for Dummies Questions & Answers perl syntax for use with urxvt and X clipboard Post 302399951 by jelloir on Tuesday 2nd of March 2010 02:38:22 AM
Old 03-02-2010
perl syntax for use with urxvt and X clipboard

I am trying to use the following perl code with urxvt terminal emulator to make using the X clipboard easier to deal with.

Code:
#! /usr/bin/perl

sub on_sel_grab {
    my $query=quotemeta $_[0]->selection;
    $query=~ s/\n/\\n/g;
    $query=~ s/\r/\\r/g;
    system( "echo -en " . $query . " | xsel -i -b -p" );
}

When utilising the script it does not behave as expected and also pastes the "-en" part of the echo command in the output.

For example, If it select "foo-bar" from urxvt and paste it into a text editor, it ends up as "-en foo-bar". I've been googling, reading perl documentation and trying to alter the code to make it work with no success.

the original information about it's usage can be found here: Rxvt-unicode - ArchWiki

perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
urxvt version = 9.06-3
I am using Debian Sid

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl syntax for sed searches

I am aware that Perl has a lot of features that originally came from sed and awk. I have a pattern that I am using like this: sed -n '/|Y|/p' I want to do the same thing in Perl and be able to either save that value in some kind of variable or array or potentially write it out to a file. ... (11 Replies)
Discussion started by: masinick
11 Replies

2. Windows & DOS: Issues & Discussions

"Striping" the background of an Rxvt/Urxvt window in Cygwin

To get this: https://www.unix.com/members/silversleevesx-albums-incidental-shot-glass-picture127-termshot-rxvt-rootless.png out of Cygwin's rxvt, you have to tweak your /cygwin/etc/x11/app-defaults/rxvt file, which is here:... (0 Replies)
Discussion started by: SilversleevesX
0 Replies

3. UNIX for Advanced & Expert Users

perl explain syntax !!!

hi all i was going through some perl code i came across this line and i am not getting what is exactly going on .. $$this{localtion} = GetName->GetVarName("EXE_DIR") ; what is the red part doing in above code (2 Replies)
Discussion started by: zedex
2 Replies

4. Shell Programming and Scripting

perl syntax help

Im new at scripting and im trying to write a script using perl that will make sure there are 2 command line integer arguments and then check if the 2nd argument is greater than the first. i believe im close but still receive my error message even when i have 2 arguments and the second part gives me... (6 Replies)
Discussion started by: livewire06
6 Replies

5. Shell Programming and Scripting

PERL Syntax Errors

Hi, I am a newbie to PERL and working on a script. When running it I get a lot of compilation errors. The actual command in the program (which is within a case structure) is given below # This gives the actual count of inquires from a log file (It works fine when I type this on the... (2 Replies)
Discussion started by: nurani
2 Replies

6. Programming

Syntax error in perl program.

Hi, i am running this code but i am getting syntax error #!/usr/bin/perl use warnings; use strict; use XML::LibXML; use XML::LibXML::Reader; use Data::Dumper; my $file; open( $file, 'DTC_Specification_transformed.xml'); my $reader = XML::LibXML::Reader->new( IO => $file ) or die... (1 Reply)
Discussion started by: veerubiji
1 Replies

7. Programming

Perl syntax question

Hallo everybody, I have a following problem - I'm doing a map funciont to fill in a HTML table and I want to use some radiobutton groups. Unfortunatelly, they are grouped by names, so I have to add some "counter" that will divide one row from another, and I'm using CGI.pm for generating the... (3 Replies)
Discussion started by: duskos
3 Replies

8. Shell Programming and Scripting

Perl syntax

I'm a newbie to perl scripting. Can someone please explain the syntax below. Specifically what does -> and => do? $tz->site( => $site); (10 Replies)
Discussion started by: scj2012
10 Replies

9. UNIX for Dummies Questions & Answers

Perl syntax

Query with perl syntax Aim: is to change a perl script to use a new file I was required to replace - entries \"$entries\" with -lib <full_path_to_filename> So in the code detector.pm sub rundetector { my $class = shift; mkdir($resultDirectory); my... (3 Replies)
Discussion started by: sa@@
3 Replies

10. Shell Programming and Scripting

A Perl Syntax Question.

Greetings! Here's what I believe is a "simple one" for the community tonight ;) What I'm trying to do is assign a "true/false" value to a variable depending upon whether a named process (some-process) exists; and then test for this value in the succeeding logic. I banged my head against the... (2 Replies)
Discussion started by: LinQ
2 Replies
urxvt(1)							   RXVT-UNICODE 							  urxvt(1)

NAME
urxvtd - urxvt terminal daemon SYNOPSIS
urxvtd [-q|--quiet] [-o|--opendisplay] [-f|--fork] [-m|--mlock] urxvtd -q -o -f # for .xsession use DESCRIPTION
This manpage describes the urxvtd daemon, which is the same vt102 terminal emulator as urxvt, but runs as a daemon that can open multiple terminal windows within the same process. You can run it from your X startup scripts, for example, although it is not dependent on a working DISPLAY and, in fact, can open windows on multiple X displays on the same time. Advantages of running a urxvt daemon include faster creation time for terminal windows and a lot of saved memory. The disadvantage is a possible impact on stability - if the main program crashes, all processes in the terminal windows are terminated. For example, as there is no way to cleanly react to abnormal connection closes, "xkill" and server resets/restarts will kill the urxvtd instance including all windows it has opened. OPTIONS
urxvtd currently understands a few options only. Bundling of options is not yet supported. -q, --quiet Normally, urxvtd outputs the message "rxvt-unicode daemon listening on <path>" after binding to its control socket. This option will suppress this message (errors and warnings will still be logged). -o, --opendisplay This forces urxvtd to open a connection to the current $DISPLAY and keep it open. This is useful if you want to bind an instance of urxvtd to the lifetime of a specific display/server. If the server does a reset, urxvtd will be killed automatically. -f, --fork This makes urxvtd fork after it has bound itself to its control socket. -m, --mlock This makes urxvtd call mlockall(2) on itself. This locks urxvtd in RAM and prevents it from being swapped out to disk, at the cost of consuming a lot more memory on most operating systems. Note: In order to use this feature, your system administrator must have set your user's RLIMIT_MEMLOCK to a size greater than or equal to the size of the urxvtd binary (or to unlimited). See /etc/security/limits.conf. Note 2: There is a known bug in glibc (possibly fixed in 2.8 and later versions) where calloc returns non-zeroed memory when mlockall is in effect. If you experience crashes or other odd behaviour while using --mlock, try it without it. EXAMPLES
This is a useful invocation of urxvtd in a .xsession-style script: urxvtd -q -f -o This waits till the control socket is available, opens the current display and forks into the background. When you log-out, the server is reset and urxvtd is killed. ENVIRONMENT
RXVT_SOCKET Both urxvtc and urxvtd use the environment variable RXVT_SOCKET to create a listening socket and to contact the urxvtd, respectively. If the variable is missing then $HOME/.urxvt/urxvtd-<nodename> is used. DISPLAY Only used when the "--opendisplay" option is specified. Must contain a valid X display name. SEE ALSO
urxvt(7), urxvtc(1) 9.15 2012-01-21 urxvt(1)
All times are GMT -4. The time now is 02:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy