Skip to content

Instantly share code, notes, and snippets.

@hungtcs
Created November 9, 2020 02:52
Show Gist options
  • Save hungtcs/426e1fa157330c0dc8069e1486342d92 to your computer and use it in GitHub Desktop.
Save hungtcs/426e1fa157330c0dc8069e1486342d92 to your computer and use it in GitHub Desktop.
Linux Shell Software Clipboard
#!/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
}
@hungtcs
Copy link
Author

hungtcs commented Nov 9, 2020

此脚本提供简单的文字粘贴板功能

复制文字

echo ABCDEFG | scopy

粘贴文字

# echo $(spaste)
spaste | xargs echo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment