Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 192969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:28:14+00:00 2026-05-11T16:28:14+00:00

Problem Not solved although one answer was accepted: We are working to get Jonah’s

  • 0

Problem Not solved although one answer was accepted: We are working to get Jonah’s code to work.

Problem: to change the code of (1) to (2)

I know the thread. I want to be able to run the following code inside Screen

Code (1)

cat ~/.vimrc | pbcopy                   (1)

Code (2)

cat ~/.vimrc > /tmp/pbcopy.pipe         (2)

My attempt to solve the problem:
to put the following code to .zshrc

function pbcopy() { "(cat \"$1\")"  > /tmp/pbcopy.pipe } 

I get

cat masi | pbcopy          
pbcopy: command not found: (cat "")
cat: masi: No such file or directory

How can you use pbcopy inside Screen?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:28:15+00:00Added an answer on May 11, 2026 at 4:28 pm

    Alright, this is a screwy answer, but it is also a screwy question, so at least they match. You can create a named pipe with mkfifo, and then setup an infinite loop that reads files from the named pipe and pipes them to pbcopy (or xsel, xclip, etc.).

    1. In a terminal which is NOT in a screen session (run this only once):

    /usr/bin/mkfifo /tmp/pbcopy.pipe
    while true; do /bin/cat /tmp/pbcopy.pipe | /usr/bin/pbcopy; done
    

    You may want to turn this into a shell script like (this probably should be more robust)

    #!/bin/bash
    
    if [[ -e /tmp/pbcopy.pipe ]]; then
        echo "it looks like I am already running"
        echo "remove /tmp/pbcopy.pipe if you are certain I am not"
        exit 1
    fi
    
    while true; do
        /bin/cat /tmp/pbcopy.pipe | /usr/bin/pbcopy
    done
    

    which you can name pbcopy_server.sh, make executable (chmod a+x pbcopy_server.sh) and put somewhere in your path, so you can say nohup pbcopy_server.sh & when you first start your machine.

    2. In any other terminal (including those in screen sessions) you can now cat files (or redirect output of programs into /tmp/pbcopy.pipe and the text will appear in the clipboard.

    cat file > /tmp/pbcopy.pipe
    
    df -h > /tmp/pbcopy.pipe
    

    3. To make it look like you are calling the real pbcopy you can use something to do the cat’ing to /tmp/pbcopy.pipe for you.

    3a. Use a zsh function:

    function pbcopy() { cat > /tmp/pbcopy.pipe }
    

    3b. Or create a Perl script named pbcopy and put it in a directory earlier in your PATH than /usr/bin:

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    open my $out, ">", "/tmp/pbcopy.pipe"
       or die "could not open pipe to pbcopy: $!\n";
    
    print $out $_ while <>;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 231k
  • Answers 231k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the following function like this: Image('/path/to/original.image', '1/1', '150*', './thumb.jpg');… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer Check you database schema to see if the field (referenced… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer I figured out the problem - there was a session… May 13, 2026 at 2:13 am

Related Questions

Problem Not solved although one answer was accepted: We are working to get Jonah's
Problem This question actually came up at work today. We are planning an experiment
This question is purely out of curiosity. I am off school for the summer,
I need to run Perl applications I develop on cygwin Windows on HP unix
The problem is not solved although I accepted one answer. Problem: Vim updates very

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.