当前位置:网站首页>A simple way to realize terminal text paste board

A simple way to realize terminal text paste board

2020-11-09 11:30:00 Hongze

Go straight to the code sclipboard.sh

#!/usr/bin/env bash

CONFIG_FOLDER=~/.config/scopy-paste
CONFIG_FILE="$CONFIG_FOLDER/value"

if [ ! -d "$CONFIG_FOLDER" ]; then
  mkdir -p "$CONFIG_FOLDER";
fi

function scopy() {
  echo -n ${*:-`cat`} > "$CONFIG_FILE";
}

function spaste() {
  if [ -f "$CONFIG_FILE" ]; then
    echo -n $(cat "$CONFIG_FILE");
  fi
}

Usage mode

First source sclipboard.sh.

#  Copy path 
pwd | scopy

#  Paste path 
ls -l $(spaste)

版权声明
本文为[Hongze]所创,转载请带上原文链接,感谢